Skip to content

Commit

Permalink
feat: always throw error when interceptor is used
Browse files Browse the repository at this point in the history
  • Loading branch information
Mert Can Altin committed Jun 19, 2024
1 parent 75fcf70 commit b2110d4
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions lib/interceptor/response-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,14 @@ class Handler extends DecoratorHandler {

const err = new ResponseError('Response Error', this.#statusCode, this.#headers, this.#body)

if (this.opts.throwOnError !== false && this.opts.error !== false) {
this.#handler.onError(err)
} else {
this.#handler.onComplete(rawTrailers)
}
this.#handler.onError(err)
} else {
this.#handler.onComplete(rawTrailers)
}
}

onError (err) {
if (this.#errored) {
// Do nothing...
} else {
if (this.opts.throwOnError !== false && this.opts.error !== false) {
this.#handler.onError(err)
} else {
this.#handler.onComplete()
}
}
this.#handler.onError(err)
}
}

Expand Down

0 comments on commit b2110d4

Please sign in to comment.