Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @param { Promise } promise
- * @param { Object= } errorExt - Additional Information you can pass to the err object
- * @return { Promise }
- */
- function to(promise, errorExt) {
- return promise
- .then(function (data) { return [null, data]; })
- .catch(function (err) {
- if (errorExt) {
- Object.assign(err, errorExt);
- }
- return [err, undefined];
- });
- }
- export { to };
- export default to;
Add Comment
Please, Sign In to add comment