Exchanges resolve state with rejection of a promise
Example usage:
import { revert } from "@thalesrc/js-utils/promise"; const errorPromise = Promise.reject(new Error('foo')); revert(errorPromise) .then(err => { console.log("this will be logged", err); }) .catch(res => { console.log("this won't be logged", res); });
Proto usage example:
import "@thalesrc/js-utils/promise/proto/revert"; Promise.reject(new Error('foo')) .revert() .then(err => { console.log("this will be logged", err); }) .catch(res => { console.log("this won't be logged", res); });
The promise to revert its statements
the reverted promise
Generated using TypeDoc
Revert Promise
Exchanges resolve state with rejection of a promise
Example usage:
import { revert } from "@thalesrc/js-utils/promise"; const errorPromise = Promise.reject(new Error('foo')); revert(errorPromise) .then(err => { console.log("this will be logged", err); }) .catch(res => { console.log("this won't be logged", res); });
Proto usage example:
import "@thalesrc/js-utils/promise/proto/revert"; Promise.reject(new Error('foo')) .revert() .then(err => { console.log("this will be logged", err); }) .catch(res => { console.log("this won't be logged", res); });