[codex] Align GitHub source control adapter errors (#2476)

Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
Julius MarmingeandJulius Marminge authored and GitHub committed 2026-05-02 16:59:03 -07:00
1 parent 6d7fe2eeb7
commit 350d76ee14
5 files changed
+16 -17

No files matched your search

+2 -1
View File
@@ -14,9 +14,10 @@ import type {
ThreadId,
} from "@t3tools/contracts";
import { GitCommandError, GitHubCliError, TextGenerationError } from "@t3tools/contracts";
import { GitCommandError, TextGenerationError } from "@t3tools/contracts";
import { type GitManagerShape } from "./GitManager.ts";
import {
GitHubCliError,
type GitHubCliShape,
type GitHubPullRequestSummary,
GitHubCli,
+12 -2
View File
@@ -1,16 +1,26 @@
import { Context, Effect, Layer, Result, Schema, SchemaIssue } from "effect";
import { GitHubCliError, TrimmedNonEmptyString, type VcsError } from "@t3tools/contracts";
import { TrimmedNonEmptyString, type VcsError } from "@t3tools/contracts";
import { VcsProcess, type VcsProcessOutput } from "../vcs/VcsProcess.ts";
import {
decodeGitHubPullRequestJson,
decodeGitHubPullRequestListJson,
formatGitHubJsonDecodeError,
} from "../git/githubPullRequests.ts";
} from "./gitHubPullRequests.ts";
const DEFAULT_TIMEOUT_MS = 30_000;
export class GitHubCliError extends Schema.TaggedErrorClass<GitHubCliError>()("GitHubCliError", {
operation: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
}) {
override get message(): string {
return `GitHub CLI failed in ${this.operation}: ${this.detail}`;
}
}
export interface GitHubPullRequestSummary {
readonly number: number;
readonly title: string;
@@ -3,11 +3,10 @@ import {
SourceControlProviderError,
type ChangeRequest,
type ChangeRequestState,
type GitHubCliError,
} from "@t3tools/contracts";
import { GitHubCli, type GitHubPullRequestSummary } from "./GitHubCli.ts";
import { decodeGitHubPullRequestListJson } from "../git/githubPullRequests.ts";
import { GitHubCli, type GitHubCliError, type GitHubPullRequestSummary } from "./GitHubCli.ts";
import { decodeGitHubPullRequestListJson } from "./gitHubPullRequests.ts";
import { SourceControlProvider, type SourceControlProviderShape } from "./SourceControlProvider.ts";
function providerError(operation: string, cause: GitHubCliError): SourceControlProviderError {
-11
View File
@@ -328,16 +328,6 @@ export class GitCommandError extends Schema.TaggedErrorClass<GitCommandError>()(
}
}
export class GitHubCliError extends Schema.TaggedErrorClass<GitHubCliError>()("GitHubCliError", {
operation: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
}) {
override get message(): string {
return `GitHub CLI failed in ${this.operation}: ${this.detail}`;
}
}
export class TextGenerationError extends Schema.TaggedErrorClass<TextGenerationError>()(
"TextGenerationError",
{
@@ -364,7 +354,6 @@ export class GitManagerError extends Schema.TaggedErrorClass<GitManagerError>()(
export const GitManagerServiceError = Schema.Union([
GitManagerError,
GitCommandError,
GitHubCliError,
SourceControlProviderError,
TextGenerationError,
]);