Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interceptors: move throwOnError to interceptor #3331

Merged
merged 28 commits into from
Jul 11, 2024
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4192b38
interceptors: move throwOnError to interceptor
Jun 16, 2024
e2321ec
delete http-errors
Jun 17, 2024
7855225
Update response-error.js
mertcanaltin Jun 17, 2024
ea068eb
Update response-error.js
mertcanaltin Jun 17, 2024
6782734
Update lib/interceptor/response-error.js
mertcanaltin Jun 17, 2024
eb29a2a
feat: added new undiciError
Jun 19, 2024
75fcf70
feat: enable interceptor by default
Jun 19, 2024
b2110d4
feat: always throw error when interceptor is used
Jun 19, 2024
e7512d3
feat: add option to throw error on specific status codes
Jun 19, 2024
2195af1
feat: export retry interceptor in index.js
Jun 19, 2024
124e0db
Update response-error.js
mertcanaltin Jun 20, 2024
d731d9f
Update response-error.js
mertcanaltin Jun 21, 2024
b0700c3
Update response-error.js
mertcanaltin Jun 21, 2024
821ea1d
Update response-error.js
mertcanaltin Jun 21, 2024
463f9a5
Update response-error.js
mertcanaltin Jun 21, 2024
a8c3149
Update response-error.js
mertcanaltin Jun 21, 2024
f5adfb2
Update lib/api/index.js
mertcanaltin Jul 1, 2024
a1b282f
lint & added more test
Jul 1, 2024
43a1b07
Update response-error.js
mertcanaltin Jul 1, 2024
0d6f450
Update response-error.js
mertcanaltin Jul 1, 2024
8980063
Update response-error.js
mertcanaltin Jul 1, 2024
636dd26
fix: test repair & unused values delete
Jul 1, 2024
72cea91
Merge branch 'main' of https://github.com/mertcanaltin/undici into ad…
Jul 8, 2024
ab619ec
fix: test problem solved
Jul 8, 2024
d5b2eb0
added types
Jul 9, 2024
e0dd09d
added Interceptor info in md
Jul 10, 2024
f10fc30
repair doc
Jul 11, 2024
ccd83e6
Update lib/interceptor/response-error.js
mertcanaltin Jul 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: always throw error when interceptor is used
Mert Can Altin committed Jun 19, 2024
commit b2110d481c47cbfedc74875e91b5a7c72ff539ef
16 changes: 2 additions & 14 deletions lib/interceptor/response-error.js
Original file line number Diff line number Diff line change
@@ -68,26 +68,14 @@ class Handler extends DecoratorHandler {

const err = new ResponseError('Response Error', this.#statusCode, this.#headers, this.#body)
mertcanaltin marked this conversation as resolved.
Show resolved Hide resolved

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)
}
}