- Throw Error objects instead of Strings.

This commit is contained in:
Paulo Gustavo Veiga
2012-09-19 20:01:22 -03:00
parent 6555203a94
commit cd776073dc
5 changed files with 316 additions and 314 deletions

View File

@@ -15,7 +15,7 @@ $assert = function (assert, message) {
if (!$defined(assert) || !assert) {
var stack;
try {
null.eval();
throw Error("Unexpected Exception");
} catch (e) {
stack = e;
}
@@ -33,7 +33,7 @@ function stackTrace(exception) {
if (!$defined(exception)) {
try {
throw "Dummy Exception"
throw Error("Unexpected Exception");
} catch (e) {
exception = e;
}
@@ -45,6 +45,8 @@ function stackTrace(exception) {
else if (window.opera && exception.message) { //Opera
result = exception.message;
} else { //IE and Safari
result = exception.sourceURL + ': ' + exception.line + "\n\n";
var currentFunction = arguments.callee.caller;
while (currentFunction) {
var fn = currentFunction.toString();