Created
January 23, 2019 09:34
-
-
Save Xotabu4/b680b0652ac556a54a1b108e0d3b780c to your computer and use it in GitHub Desktop.
Hadling it errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("describing", function() { | |
it("", myWrapper(async function () { | |
await new Promise((resolve, reject)=> { | |
setTimeout(()=> reject(new Error('Test error!')), 1000) | |
}) | |
})); | |
}); | |
function myWrapper(fn) { | |
return async function() { | |
try { | |
await fn(); | |
} catch (err) { | |
console.log('OMG DOING SOMETHING WITH ERROR') | |
throw err | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment