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

[json-rpc-engine] Improve handling for unexpected middleware error types, align error types to use JsonRpcEngineCallbackError #4027

Open
MajorLift opened this issue Mar 7, 2024 · 0 comments

Comments

@MajorLift
Copy link
Contributor

MajorLift commented Mar 7, 2024

Motivation

Currently, JsonRpcEngine handles non-JSON-RPC errors thrown from middleware by passing them into end callbacks without validation or serialization.

Fixing this is necessary to take full advantage of the provider alignment technical proposals, as JsonRpcEngine is the call site for the provider methods. A more accurately typed JsonRpcEngine would enable us to make potential typing improvements to the providers as well.

Explanation

The code for handling these errors suppresses valid errors by using type assertions (as JsonRpcEngineCallbackError), despite their being no guarantee that the thrown errors will be of that type. These assertions (currently marked by TODO comments) should be removed and replaced with type-safe code.

We should align error types used throughout middleware the chain with the JsonRpcEngineCallbackError type. This may involve coming up with a scheme for lossless serialization of errors that explicitly preserves information that is expected by JsonRpcEngine.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant