* 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)
| 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%% |