- Try to catch more exception details.

This commit is contained in:
Paulo Gustavo Veiga
2012-09-22 21:34:43 -03:00
parent f5d3b51f6e
commit 88f5f1a5bd
3 changed files with 28 additions and 97 deletions

View File

@@ -13,15 +13,9 @@ $defined = function (obj) {
$assert = function (assert, message) {
if (!$defined(assert) || !assert) {
var stack;
try {
throw Error("Unexpected Exception");
} catch (e) {
stack = e;
}
console.log(message + "," + stack);
window.errorStack = stackTrace();
throw message;
logStackTrace();
console.log(message);
throw new Error(message);
}
};
@@ -29,7 +23,7 @@ Math.sign = function (value) {
return (value >= 0) ? 1 : -1;
};
function stackTrace(exception) {
function logStackTrace(exception) {
if (!$defined(exception)) {
try {
@@ -54,7 +48,7 @@ function stackTrace(exception) {
currentFunction = currentFunction.caller;
}
}
window.errorStack = result;
return result;
}