Created
May 16, 2019 12:22
-
-
Save mpapec/27f55da1cb2bb92eb36ea0c12d421274 to your computer and use it in GitHub Desktop.
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
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