ngrok / ngrok-javascript

Embed ngrok secure ingress into your Node.js apps with a single line of code.
https://ngrok.com
Apache License 2.0
86 stars 17 forks source link

Consume and return new `NgrokError` trait, which now includes `error_code` for users #67

Closed CarlAmko closed 10 months ago

CarlAmko commented 10 months ago

Previously, connect errors via Rust were returned as strings. They've now been augmented to include the ngrok error code as a field. We can now make this information more accessible to the high-level API calls.

See the parent issue for more details.

bobzilladev commented 10 months ago

Have exhausted attempts to do this the good way, napi-rs just doesn't have an angle to get more fields in the generated JsError at this time, and we can't manually throw an error inside an async function (can't have injected env there) which is where all the ngrok.Error's are generated from. So trailer.js to the rescue again, have line-of-sight to attach an error code there.

Others trying to do the same thing:

bobzilladev commented 10 months ago

Pull request: https://github.com/ngrok/ngrok-nodejs/pull/73