-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Error subclasses are lost when deserializing #48
Comments
The good part is that |
Good idea 👍 |
I think this could have an internal list of known constructors that could be extended/overridden by the user. Some can be found at: https://developer.mozilla.org/en-US/docs/web/javascript/reference/global_objects/error Actually supporting all those error correctly might not be possible, but a plain |
What do you think about exporting a global set of supported errors? This would avoid having to manually pass this around (and potentially forget to), as well enabling support across modules (and sub dependencies) import {errorClasses} from 'serialize-error';
errorClasses.push(MyError, CoolError, APIError); 👆 Maybe an array is better because |
Sure. I don't think it should contain the built-in error types though. We don't want users to be able to remove those. So maybe it should be named |
…P response - Also sets the status code dynamically based on presence of tx submission errors. - Note: This currently looses the custom type precision, however it appears there's a feature in development to address this: sindresorhus/serialize-error#48 - Tests are also improved to avoid false positives
…ubmitHttpProvider - Note: While this rehydrates errors, until sindresorhus/serialize-error#48, the type precision is lost. The error.name can be used to differentiate the type for now. - Also improves tests to avoid false-positives - Fixes JSDoc references
…P response - Also sets the status code dynamically based on presence of tx submission errors. - Note: This currently looses the custom type precision, however it appears there's a feature in development to address this: sindresorhus/serialize-error#48 - Tests are also improved to avoid false positives
…ubmitHttpProvider - Note: While this rehydrates errors, until sindresorhus/serialize-error#48, the type precision is lost. The error.name can be used to differentiate the type for now. - Also improves tests to avoid false-positives - Fixes JSDoc references
- uses the `TxSubmitProvider` interface to facilitate both queue and direct submission - /submit accepts cbor-encoded binary data to remain aligned with other Cardano APIs - serialize tx submit errors in HTTP response - Sets the status code dynamically based on presence of tx submission errors. - Note: This currently looses the custom type precision, however it appears there's a feature in development to address this: sindresorhus/serialize-error#48 - CLI entrypoint using Commander - run entrypoint for ENV configuration feat(cardano-graphql-services): configurable request limit in TxSubmitHttpServer
- Uses got as the HTTP request library. It's pinned at the previous major version as the latest is incompatible with CommonJS, so I've elected stay on v11 until we look at our module strategy and targets. sindresorhus/got#1789 - deserialize and throw domain errors - Note: While this rehydrates errors, until sindresorhus/serialize-error#48, the type precision is lost. The error.name can be used to differentiate the type for now. - Fixes JSDoc references
- uses the `TxSubmitProvider` interface to facilitate both queue and direct submission - /submit accepts cbor-encoded binary data to remain aligned with other Cardano APIs - serialize tx submit errors in HTTP response - Sets the status code dynamically based on presence of tx submission errors. - Note: This currently looses the custom type precision, however it appears there's a feature in development to address this: sindresorhus/serialize-error#48 - CLI entrypoint using Commander - run entrypoint for ENV configuration feat(cardano-graphql-services): configurable request limit in TxSubmitHttpServer
- Uses got as the HTTP request library. It's pinned at the previous major version as the latest is incompatible with CommonJS, so I've elected stay on v11 until we look at our module strategy and targets. sindresorhus/got#1789 - deserialize and throw domain errors - Note: While this rehydrates errors, until sindresorhus/serialize-error#48, the type precision is lost. The error.name can be used to differentiate the type for now. - Fixes JSDoc references
- uses the `TxSubmitProvider` interface to facilitate both queue and direct submission - /submit accepts cbor-encoded binary data to remain aligned with other Cardano APIs - serialize tx submit errors in HTTP response - Sets the status code dynamically based on presence of tx submission errors. - Note: This currently looses the custom type precision, however it appears there's a feature in development to address this: sindresorhus/serialize-error#48 - CLI entrypoint using Commander - run entrypoint for ENV configuration - configurable request limit in TxSubmitHttpServer - ensure txSubmitProvider is healthy on TxSubmitHttpServer init, otherwise throw `ProviderFailure.Unhealthy`. - throw provider error if unhealthy during TxSubmitHttpServer submit, and return 503 HTTP status code
- Uses got as the HTTP request library. It's pinned at the previous major version as the latest is incompatible with CommonJS, so I've elected stay on v11 until we look at our module strategy and targets. sindresorhus/got#1789 - deserialize and throw domain errors - Note: While this rehydrates errors, until sindresorhus/serialize-error#48, the type precision is lost. The error.name can be used to differentiate the type for now. - Fixes JSDoc references
Hey @sindresorhus! Would you be open to another PR adding support for |
You can open a new issue. Given it’s a complex error, it first needs proper serialization support. |
original
will be aMyError
butdeserialized
will be a plainError
Live example: https://runkit.com/embed/f46ewcgxyxqg
I think
deserializeError
should support custom error types, if passed as an argument (so they are known and explicit):Native errors also should be automatically supported, like
TypeError
The text was updated successfully, but these errors were encountered: