Skip to content

Implement SnapError #1824

Closed
Closed

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.

Activity

  1. self-assigned this
    on Oct 10, 2023
  2. kenhkan commented on Oct 17, 2023

    @kenhkan
  3. added 2 commits that reference this issue on Oct 20, 2023
    3f374b4
    0f40614
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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