1- import type {
1+ import {
22 EnvironmentAuthInvalidError ,
3- PullRequestDiffInput ,
4- PullRequestDiffResult ,
3+ type PullRequestDiffInput ,
4+ type PullRequestDiffResult ,
55} from "@t3tools/contracts" ;
66import * as Context from "effect/Context" ;
7- import * as Data from "effect/Data" ;
87import * as Effect from "effect/Effect" ;
98import * as Layer from "effect/Layer" ;
109import * as Option from "effect/Option" ;
10+ import * as Schema from "effect/Schema" ;
1111import { HttpClient } from "effect/unstable/http" ;
1212
1313import type { PreparedConnection } from "../connection/model.ts" ;
@@ -22,9 +22,15 @@ import { buildEnvironmentAuthHeaders, withEnvironmentCredentials } from "./envir
2222
2323const DEFAULT_PULL_REQUEST_DIFF_TIMEOUT_MS = 60_000 ;
2424
25- export class PullRequestDiffCredentialRejectedError extends Data . TaggedError (
25+ export class PullRequestDiffCredentialRejectedError extends Schema . TaggedErrorClass < PullRequestDiffCredentialRejectedError > ( ) (
2626 "PullRequestDiffCredentialRejectedError" ,
27- ) < { readonly cause : EnvironmentAuthInvalidError } > {
27+ {
28+ repository : Schema . String ,
29+ number : Schema . Number ,
30+ traceId : Schema . String ,
31+ cause : EnvironmentAuthInvalidError ,
32+ } ,
33+ ) {
2834 override get message ( ) : string {
2935 return "This environment session is no longer valid (invalid_credential). Refresh the page or quit and reopen T3 Code." ;
3036 }
@@ -62,7 +68,12 @@ export const fetchEnvironmentPullRequestDiff = Effect.fn(
6268 ) . pipe (
6369 Effect . mapError ( ( error ) =>
6470 error . _tag === "EnvironmentAuthInvalidError" && error . reason === "invalid_credential"
65- ? new PullRequestDiffCredentialRejectedError ( { cause : error } )
71+ ? new PullRequestDiffCredentialRejectedError ( {
72+ repository : input . diff . repository ,
73+ number : input . diff . number ,
74+ traceId : error . traceId ,
75+ cause : error ,
76+ } )
6677 : error ,
6778 ) ,
6879 ) ;
0 commit comments