Skip to content

Throwing errors should not always crash the Snap #1779

Description

@Mrtenz

Currently, when you throw an error in the onRpcRequest handler for example, the entire Snap will crash.

export const onRpcRequest = (...) => {
  // ...
  throw new Error('Invalid parameters.');
};

This is problematic when there are multiple requests happening at the same time, because all requests will be canceled.

We should add a way for a Snap to throw an error while not causing the entire Snap to crash, but rather respond with an error to the specific RPC request.

Activity

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

Metadata

Metadata

Labels

area-capabilitiesRelated to the kinds of things that snaps are able to do.type-enhancementNew feature or requesttype-researchA research task.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions