UNPKG

@metamask/snaps-simulation

Version:

A simulation framework for MetaMask Snaps, enabling headless testing of Snaps in a controlled environment

27 lines 823 B
import { getJsonError } from "@metamask/snaps-sdk"; import { put } from "redux-saga/effects"; import { trackError } from "../../store/index.mjs"; /** * Track an error. * * @param error - The error to track. * @returns `null`. * @yields Adds the error to the store. */ function* trackErrorImplementation(error) { const serialisedError = getJsonError(error); yield put(trackError(serialisedError)); return null; } /** * Get a method that can be used to track an error. * * @param runSaga - A function to run a saga outside the usual Redux flow. * @returns A method that can be used to track an error. */ export function getTrackErrorImplementation(runSaga) { return (...args) => { return runSaga(trackErrorImplementation, ...args).result(); }; } //# sourceMappingURL=track-error.mjs.map