Skip to content

Instantly share code, notes, and snippets.

View DefiantBidet's full-sized avatar
🐷

James Dean DefiantBidet

🐷
View GitHub Profile
function translateError(msg) {
var newErr = new Error(msg); // placed here to get correct stack
return e => {
newErr.originalError = e;
throw newErr;
}
}
async function asyncTask() {
const user = await UserModel.findById(1).catch(translateError('No user found'))