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:
thrownewSnapError(error);// { code: -32000; message: error.message; data: { stack: error.stack }}thrownewSnapError('message'); -->
// { code: -32000; message: 'message'; }thrownewSnapError({code: ...;message: ...;});// { code: ...; message: ...; }Related to #1779.
If a Snap throws a
SnapError(standardised error class), the Snap should not crash. This is useful in non-JSON-RPC contexts, such asonTransaction,onCronjob. TheSnapErrorshould be serialisable to JSON internally:Related to #1779.