feat: better errors for Node.JS bindings#406
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves error reporting across the Node.js bindings by propagating more specific native error categories (notably proxy CONNECT failures) and rethrowing them as typed JS error classes, aligning with issue #397’s request for actionable connection-phase failures.
Changes:
- Added new Rust error variants for proxy CONNECT tunnel failures and proxy auth requirements, and attempted to detect these from underlying
hyper_utiltunnel errors. - Updated Node.js bindings to emit a stable error code prefix and rethrow native errors as specific JS
Errorsubclasses. - Pinned
tower-httpand patchedhyper-utilto specific git revisions (and updated the lockfile accordingly).
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
impit/src/errors.rs |
Adds ProxyTunnelError / ProxyAuthRequired and maps TunnelError into these variants. |
impit-python/src/errors.rs |
Handles the new Rust variants in Python error conversion (currently mapped to ProxyError). |
impit-node/src/lib.rs |
Encodes ImpitError variants into string error codes for JS rethrowing. |
impit-node/index.wrapper.js |
Uses rethrowNativeError on failures and exports the new JS error classes. |
impit-node/index.js |
Updates native binding version checks to 0.10.1. |
impit-node/errors.js |
Introduces JS error class hierarchy + rethrowNativeError mapping logic. |
Cargo.toml |
Pins tower-http and adds a git patch for hyper-util. |
Cargo.lock |
Reflects the patched/pinned dependency sources. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
980c10f to
2a02cd5
Compare
2a02cd5 to
0411e3d
Compare
|
cc @Pijukatel the review request is just for learning purposes, as discussed in the meeting yesterday (but ofc feel free to chip in with tips, I don't really like the implementation 😄 ) |
|
cc @bliuchak & @daniil-poletaev, please feel free to check if the changes match your expectations |
daniil-poletaev
left a comment
There was a problem hiding this comment.
Nice, thank you for taking care of this ❤️
Tested it and it works as expected and returns status code
Closes #397.