UNPKG

@metamask/snaps-simulation

Version:

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

31 lines 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getTrackErrorImplementation = void 0; const snaps_sdk_1 = require("@metamask/snaps-sdk"); const effects_1 = require("redux-saga/effects"); const store_1 = require("../../store/index.cjs"); /** * Track an error. * * @param error - The error to track. * @returns `null`. * @yields Adds the error to the store. */ function* trackErrorImplementation(error) { const serialisedError = (0, snaps_sdk_1.getJsonError)(error); yield (0, effects_1.put)((0, store_1.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. */ function getTrackErrorImplementation(runSaga) { return (...args) => { return runSaga(trackErrorImplementation, ...args).result(); }; } exports.getTrackErrorImplementation = getTrackErrorImplementation; //# sourceMappingURL=track-error.cjs.map