(controller, trailers)
| 52 | } |
| 53 | |
| 54 | onResponseEnd (controller, trailers) { |
| 55 | if (this.#statusCode >= 400) { |
| 56 | this.#body += this.#decoder?.decode(undefined, { stream: false }) ?? '' |
| 57 | |
| 58 | if (this.#checkContentType('application/json')) { |
| 59 | try { |
| 60 | this.#body = JSON.parse(this.#body) |
| 61 | } catch { |
| 62 | // Do nothing... |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | let err |
| 67 | const stackTraceLimit = Error.stackTraceLimit |
| 68 | Error.stackTraceLimit = 0 |
| 69 | try { |
| 70 | err = new ResponseError('Response Error', this.#statusCode, { |
| 71 | body: this.#body, |
| 72 | headers: this.#headers |
| 73 | }) |
| 74 | } finally { |
| 75 | Error.stackTraceLimit = stackTraceLimit |
| 76 | } |
| 77 | |
| 78 | super.onResponseError(controller, err) |
| 79 | } else { |
| 80 | super.onResponseEnd(controller, trailers) |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | onResponseError (controller, err) { |
| 85 | super.onResponseError(controller, err) |
nothing calls this directly
no test coverage detected