Skip to content

Instantly share code, notes, and snippets.

@ChecksumFailed
Created June 12, 2024 18:25
Show Gist options
  • Save ChecksumFailed/6ef839afe8099a9653ac1bc0cee76f0a to your computer and use it in GitHub Desktop.
Save ChecksumFailed/6ef839afe8099a9653ac1bc0cee76f0a to your computer and use it in GitHub Desktop.
/**
* Normalzies exception string for logging
* @param {Exception} e
* @returns {string} message
* @private
*/
{
_formatErrorMessage: function (e) {
try {
if (e instanceof Error) {
if (!gs.nil(e.name) && !gs.nil(e.lineNumber)) {
e.name += "(" + e.lineNumber + ")";
}
return e.toString();
}
if (typeof e === "string") {
return e;
}
} catch (e) {
return "_formatErrorMessage: fail.";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment