I can give you just the idea.
You can do it from analysis of the value of the member
.stack
of the exception object:
function ProcessExceptionInformation(message, stack) {
}
<pre lang="JavaScript">try {
} catch(e) {
ProcessExceptionInformation(e.message, e.stack);
}
—SA