Skip to content

Instantly share code, notes, and snippets.

@Xotabu4
Created January 23, 2019 09:34
Show Gist options
  • Save Xotabu4/b680b0652ac556a54a1b108e0d3b780c to your computer and use it in GitHub Desktop.
Save Xotabu4/b680b0652ac556a54a1b108e0d3b780c to your computer and use it in GitHub Desktop.
Hadling it errors
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