Skip to content

Instantly share code, notes, and snippets.

@mpapec
Created May 16, 2019 12:22
Show Gist options
  • Save mpapec/27f55da1cb2bb92eb36ea0c12d421274 to your computer and use it in GitHub Desktop.
Save mpapec/27f55da1cb2bb92eb36ea0c12d421274 to your computer and use it in GitHub Desktop.
module.exports = {
die: function(err) {
let e = new Error();
let frame = e.stack.split("\n")[2];
let arr = frame.split(" ");
// let functionName = arr[5];
let where = arr[6].split(/[:()]/);
let fileName = where[1];
let lineNumber = where[2];
throw (err || "Died").toString().replace(/\w+:\s*/g, '') +" at "+ fileName +" line "+ lineNumber +".";
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment