Skip to content

Commit 350d76e

Browse files
juliusmarmingeJulius Marminge
andauthored
[codex] Align GitHub source control adapter errors (#2476)
Co-authored-by: Julius Marminge <julius@macmini.local>
1 parent 6d7fe2e commit 350d76e

5 files changed

Lines changed: 16 additions & 17 deletions

File tree

apps/server/src/git/GitManager.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ import type {
1414
ThreadId,
1515
} from "@t3tools/contracts";
1616

17-
import { GitCommandError, GitHubCliError, TextGenerationError } from "@t3tools/contracts";
17+
import { GitCommandError, TextGenerationError } from "@t3tools/contracts";
1818
import { type GitManagerShape } from "./GitManager.ts";
1919
import {
20+
GitHubCliError,
2021
type GitHubCliShape,
2122
type GitHubPullRequestSummary,
2223
GitHubCli,

apps/server/src/sourceControl/GitHubCli.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
import { Context, Effect, Layer, Result, Schema, SchemaIssue } from "effect";
22

3-
import { GitHubCliError, TrimmedNonEmptyString, type VcsError } from "@t3tools/contracts";
3+
import { TrimmedNonEmptyString, type VcsError } from "@t3tools/contracts";
44

55
import { VcsProcess, type VcsProcessOutput } from "../vcs/VcsProcess.ts";
66
import {
77
decodeGitHubPullRequestJson,
88
decodeGitHubPullRequestListJson,
99
formatGitHubJsonDecodeError,
10-
} from "../git/githubPullRequests.ts";
10+
} from "./gitHubPullRequests.ts";
1111

1212
const DEFAULT_TIMEOUT_MS = 30_000;
1313

14+
export class GitHubCliError extends Schema.TaggedErrorClass<GitHubCliError>()("GitHubCliError", {
15+
operation: Schema.String,
16+
detail: Schema.String,
17+
cause: Schema.optional(Schema.Defect),
18+
}) {
19+
override get message(): string {
20+
return `GitHub CLI failed in ${this.operation}: ${this.detail}`;
21+
}
22+
}
23+
1424
export interface GitHubPullRequestSummary {
1525
readonly number: number;
1626
readonly title: string;

apps/server/src/sourceControl/GitHubSourceControlProvider.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import {
33
SourceControlProviderError,
44
type ChangeRequest,
55
type ChangeRequestState,
6-
type GitHubCliError,
76
} from "@t3tools/contracts";
87

9-
import { GitHubCli, type GitHubPullRequestSummary } from "./GitHubCli.ts";
10-
import { decodeGitHubPullRequestListJson } from "../git/githubPullRequests.ts";
8+
import { GitHubCli, type GitHubCliError, type GitHubPullRequestSummary } from "./GitHubCli.ts";
9+
import { decodeGitHubPullRequestListJson } from "./gitHubPullRequests.ts";
1110
import { SourceControlProvider, type SourceControlProviderShape } from "./SourceControlProvider.ts";
1211

1312
function providerError(operation: string, cause: GitHubCliError): SourceControlProviderError {
File renamed without changes.

packages/contracts/src/git.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -328,16 +328,6 @@ export class GitCommandError extends Schema.TaggedErrorClass<GitCommandError>()(
328328
}
329329
}
330330

331-
export class GitHubCliError extends Schema.TaggedErrorClass<GitHubCliError>()("GitHubCliError", {
332-
operation: Schema.String,
333-
detail: Schema.String,
334-
cause: Schema.optional(Schema.Defect),
335-
}) {
336-
override get message(): string {
337-
return `GitHub CLI failed in ${this.operation}: ${this.detail}`;
338-
}
339-
}
340-
341331
export class TextGenerationError extends Schema.TaggedErrorClass<TextGenerationError>()(
342332
"TextGenerationError",
343333
{
@@ -364,7 +354,6 @@ export class GitManagerError extends Schema.TaggedErrorClass<GitManagerError>()(
364354
export const GitManagerServiceError = Schema.Union([
365355
GitManagerError,
366356
GitCommandError,
367-
GitHubCliError,
368357
SourceControlProviderError,
369358
TextGenerationError,
370359
]);

0 commit comments

Comments
 (0)