diff options
| author | Misko Hevery | 2010-11-16 13:57:41 -0800 |
|---|---|---|
| committer | Igor Minar | 2010-11-16 14:19:55 -0800 |
| commit | b2d63ac48bdc61b5a4afdd10b8485c0c1ab8cdca (patch) | |
| tree | 0b798ba07d5b593dcc3e27964e81eb0542440d56 /src/Angular.js | |
| parent | 4af32de84a264e05eebfa6dbc09ce10fac1e1417 (diff) | |
| download | angular.js-b2d63ac48bdc61b5a4afdd10b8485c0c1ab8cdca.tar.bz2 | |
Changed error handling so that better stack traces are displayed in the ng-errors
Diffstat (limited to 'src/Angular.js')
| -rw-r--r-- | src/Angular.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Angular.js b/src/Angular.js index 5a5a4ab3..e0cf2df4 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -84,6 +84,7 @@ var _undefined = undefined, PRIORITY_WATCH = -1000, PRIORITY_LAST = 99999, PRIORITY = {'FIRST': PRIORITY_FIRST, 'LAST': PRIORITY_LAST, 'WATCH':PRIORITY_WATCH}, + Error = window.Error, jQuery = window['jQuery'] || window['$'], // weirdness to make IE happy _ = window['_'], /** holds major version number for IE or NaN for real browsers */ @@ -557,6 +558,18 @@ function foreachSorted(obj, iterator, context) { } +function formatError(arg) { + if (arg instanceof Error) { + if (arg.stack) { + arg = arg.stack; + } else if (arg.sourceURL) { + arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line; + } + } + return arg; +} + + function extend(dst) { foreach(arguments, function(obj){ if (obj !== dst) { |
