Skip to content

Throwing errors should not always crash the Snap #1779

@Mrtenz

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.

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