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.
Currently, when you throw an error in the
onRpcRequesthandler for example, the entire Snap will crash.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.