Skip to content

Implement SnapError #1824

@Mrtenz

Description

@Mrtenz

If a Snap throws a SnapError (standardised error class), the Snap should not crash. This is useful in non-JSON-RPC contexts, such as onTransaction, onCronjob. The SnapError should be serialisable to JSON internally:

throw new SnapError(error);
// { code: -32000; message: error.message; data: { stack: error.stack }}

throw new SnapError('message'); -->
// { code: -32000; message: 'message'; }

throw new SnapError({ code: ...; message: ...; });
// { code: ...; message: ...; }

Related to #1779.

Metadata

Metadata

Assignees

Labels

area-capabilitiesRelated to the kinds of things that snaps are able to do.type-enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions