quic: add proper error codes & messages for QUIC failures#63198
quic: add proper error codes & messages for QUIC failures#63198pimterry wants to merge 5 commits into
Conversation
|
Review requested:
|
31b4709 to
aefee4f
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #63198 +/- ##
==========================================
- Coverage 91.68% 90.05% -1.63%
==========================================
Files 361 714 +353
Lines 156230 225775 +69545
Branches 24021 42721 +18700
==========================================
+ Hits 143232 203315 +60083
- Misses 12729 14233 +1504
- Partials 269 8227 +7958
🚀 New features to boost your workflow:
|
Ethan-Arrowood
left a comment
There was a problem hiding this comment.
this is a great change.
Ethan-Arrowood
left a comment
There was a problem hiding this comment.
this is a great change.
Signed-off-by: Tim Perry <pimterry@gmail.com>
Signed-off-by: Tim Perry <pimterry@gmail.com>
Signed-off-by: Tim Perry <pimterry@gmail.com>
40eebfd to
60b6e3b
Compare
|
Updated to use bindingdata, rebased and force pushed because we need to update the test from #63193 (just merged) as well since that asserted on the error message. |
Qard
left a comment
There was a problem hiding this comment.
Is there some reason you're undid the use of the existing core errors system? Shouldn't we be keeping that?
| function makeQuicError(code, prefix, type, errorCode, reason, errorName) { | ||
| const err = new QuicError( | ||
| quicErrorMessage(prefix, errorCode, reason, errorName), | ||
| { errorCode, code, type }); | ||
| if (reason) err.reason = reason; | ||
| if (errorName) err.errorName = errorName; | ||
| return err; | ||
| } |
There was a problem hiding this comment.
Should we not keep the same error construction mechanism as the others? We lose a bunch of things by not using that. Not sure we should be taking these out of the global errors set.
There was a problem hiding this comment.
This was a suggestion here, changed here.
We still use standard error codes, but we use a single QuicError class instead of the standard construction of per-code error classes: https://github.com/nodejs/node/blob/main/doc/api/quic.md#class-quicerror. This error class is used by users as well to control QUIC error behaviour, and this approach gives us consistent errors for every kind of failure at the protocol level. I don't feel strongly about it myself, but it seemed like a reasonable suggestion and having a single QUIC error class is tidy.
What do we lose by not using the standard error mechanism vs this setup?
This wraps QUIC errors, providing useful error codes and messages for the defined error code cases from both OpenSSL and ngtcp2.
Before this, QUIC errors looked like:
Now they look like: