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

Method makeServerError

lib.esm/utils/fetch.js:761–773  ·  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, error)

Source from the content-addressed store, hash-verified

759 * optional %%error%%.
760 */
761 makeServerError(message, error) {
762 let statusMessage;
763 if (!message) {
764 message = `${this.statusCode} ${this.statusMessage}`;
765 statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`;
766 }
767 else {
768 statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`;
769 }
770 const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.#request || undefined);
771 response.#error = { message, error };
772 return response;
773 }
774 /**
775 * If called within a [request.processFunc](FetchRequest-processFunc)
776 * call, causes the request to retry as if throttled for %%stall%%

Callers 1

#sendMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected