Showing the changes to apps/server/src/sourceControl (3 of 86 files). Show all
Unified · Split
| @@ -44,6 +44,7 @@ export class BitbucketApiError extends Schema.TaggedErrorClass<BitbucketApiError · 43 unmodified lines | ||
| 44 | 44 | return `Bitbucket API failed in ${this.operation}: ${this.detail}`; |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | +const isBitbucketApiErrorValue = Schema.is(BitbucketApiError); | |
| 47 | 48 | |
| 48 | 49 | const RawBitbucketRepositorySchema = Schema.Struct({ |
| 49 | 50 | full_name: TrimmedNonEmptyString, |
| @@ -350,7 +351,7 @@ function requestError(operation: string, cause: unknown): BitbucketApiError { · 300 unmodified lines | ||
| 350 | 351 | } |
| 351 | 352 | |
| 352 | 353 | function isBitbucketApiError(cause: unknown): cause is BitbucketApiError { |
| 353 | − return Schema.is(BitbucketApiError)(cause); | |
| 354 | + return isBitbucketApiErrorValue(cause); | |
| 354 | 355 | } |
| 355 | 356 | |
| 356 | 357 | function responseError( |
| @@ -13,6 +13,7 @@ import * as GitHubCli from "./GitHubCli.ts"; · 12 unmodified lines | ||
| 13 | 13 | import * as GitHubPullRequests from "./gitHubPullRequests.ts"; |
| 14 | 14 | import * as SourceControlProvider from "./SourceControlProvider.ts"; |
| 15 | 15 | import * as SourceControlProviderDiscovery from "./SourceControlProviderDiscovery.ts"; |
| 16 | +const isSourceControlProviderError = Schema.is(SourceControlProviderError); | |
| 16 | 17 | |
| 17 | 18 | function providerError( |
| 18 | 19 | operation: string, |
| @@ -153,7 +154,7 @@ export const make = Effect.fn("makeGitHubSourceControlProvider")(function* () { · 134 unmodified lines | ||
| 153 | 154 | ); |
| 154 | 155 | }), |
| 155 | 156 | Effect.mapError((error) => |
| 156 | − Schema.is(SourceControlProviderError)(error) | |
| 157 | + isSourceControlProviderError(error) | |
| 157 | 158 | ? error |
| 158 | 159 | : providerError("listChangeRequests", error), |
| 159 | 160 | ), |
| @@ -22,6 +22,7 @@ import { · 21 unmodified lines | ||
| 22 | 22 | import { ServerConfig } from "../config.ts"; |
| 23 | 23 | import * as GitVcsDriver from "../vcs/GitVcsDriver.ts"; |
| 24 | 24 | import * as SourceControlProviderRegistry from "./SourceControlProviderRegistry.ts"; |
| 25 | +const isSourceControlRepositoryError = Schema.is(SourceControlRepositoryError); | |
| 25 | 26 | |
| 26 | 27 | export interface SourceControlRepositoryServiceShape { |
| 27 | 28 | readonly lookupRepository: ( |
| @@ -69,7 +70,7 @@ function repositoryError(input: { · 41 unmodified lines | ||
| 69 | 70 | |
| 70 | 71 | function mapRepositoryError(operation: string, provider: SourceControlProviderKind) { |
| 71 | 72 | return Effect.mapError((cause: unknown) => |
| 72 | − Schema.is(SourceControlRepositoryError)(cause) | |
| 73 | + isSourceControlRepositoryError(cause) | |
| 73 | 74 | ? cause |
| 74 | 75 | : repositoryError({ |
| 75 | 76 | operation, |