MCPcopy Create free account
hub / github.com/PageLeay/celestial-runtime / makeServerError

Method makeServerError

src.ts/utils/fetch.ts:873–885  ·  view source on GitHub ↗

* Return a Response with matching headers and body, but with * an error status code (i.e. 599) and %%message%% with an * optional %%error%%.

(message?: string, error?: Error)

Source from the content-addressed store, hash-verified

871 * optional %%error%%.
872 */
873 makeServerError(message?: string, error?: Error): FetchResponse {
874 let statusMessage: string;
875 if (!message) {
876 message = `${ this.statusCode } ${ this.statusMessage }`;
877 statusMessage = `CLIENT ESCALATED SERVER ERROR (${ message })`;
878 } else {
879 statusMessage = `CLIENT ESCALATED SERVER ERROR (${ this.statusCode } ${ this.statusMessage }; ${ message })`;
880 }
881 const response = new FetchResponse(599, statusMessage, this.headers,
882 this.body, this.#request || undefined);
883 response.#error = { message, error };
884 return response;
885 }
886
887 /**
888 * If called within a [request.processFunc](FetchRequest-processFunc)

Callers 1

#sendMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected