@@ -103,11 +103,14 @@ export class CodexInstallationError extends Schema.TaggedError<CodexInstallation
103103 {
104104 operation : Schema . String ,
105105 detail : Schema . String ,
106+ httpStatus : Schema . optional ( Schema . Number ) ,
106107 cause : Schema . optional ( Schema . Defect ( ) ) ,
107108 } ,
108109) {
109110 override get message ( ) {
110- return this . detail ;
111+ return this . httpStatus === undefined
112+ ? this . detail
113+ : `The Codex download server returned HTTP ${ this . httpStatus } . Try again later.` ;
111114 }
112115}
113116const isInstallationError = Schema . is ( CodexInstallationError ) ;
@@ -565,14 +568,19 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function
565568 } ,
566569 Effect . scoped ,
567570 Effect . catchTags ( {
568- HttpClientError : ( cause ) =>
569- installationError (
570- "download" ,
571- cause . reason . _tag === "StatusCodeError"
572- ? `The Codex download server returned HTTP ${ cause . reason . response . status } . Try again later.`
573- : "The Codex download was interrupted. Check your internet connection, then retry installation." ,
571+ HttpClientError : ( cause ) => {
572+ const httpStatus =
573+ cause . reason . _tag === "StatusCodeError" ? cause . reason . response . status : undefined ;
574+ return new CodexInstallationError ( {
575+ operation : "download" ,
576+ detail :
577+ httpStatus === undefined
578+ ? "The Codex download was interrupted. Check your internet connection, then retry installation."
579+ : "The Codex download server returned an HTTP error. Try again later." ,
580+ ...( httpStatus === undefined ? { } : { httpStatus } ) ,
574581 cause,
575- ) ,
582+ } ) ;
583+ } ,
576584 } ) ,
577585 Effect . mapError (
578586 wrapFailure (
@@ -620,7 +628,7 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function
620628 message : cancelled
621629 ? "Installation cancelled. The previous runtime is unchanged."
622630 : Option . isSome ( error )
623- ? error . value . detail
631+ ? error . value . message
624632 : "Could not finish the Codex installation. Check disk space and directory access." ,
625633 } satisfies ProviderInstallState ;
626634 } )
0 commit comments