|
1 | | -/*! Raven.js 3.3.0 (74c6c03) | github.com/getsentry/raven-js */ |
| 1 | +/*! Raven.js 3.4.0 (4dba6fe) | github.com/getsentry/raven-js */ |
2 | 2 |
|
3 | 3 | /* |
4 | 4 | * Includes TraceKit |
|
19 | 19 | 'use strict'; |
20 | 20 |
|
21 | 21 | // See https://github.com/angular/angular.js/blob/v1.4.7/src/minErr.js |
22 | | -var angularPattern = /^\[((?:[$a-zA-Z0-9]+:)?(?:[$a-zA-Z0-9]+))\] (.+?)\n(\S+)$/; |
| 22 | +var angularPattern = /^\[((?:[$a-zA-Z0-9]+:)?(?:[$a-zA-Z0-9]+))\] (.*?)\n?(\S+)$/; |
| 23 | + |
23 | 24 |
|
24 | 25 | function angularPlugin(Raven, angular) { |
25 | 26 | angular = angular || window.angular; |
@@ -51,25 +52,31 @@ function angularPlugin(Raven, angular) { |
51 | 52 | .config(['$provide', ExceptionHandlerProvider]); |
52 | 53 |
|
53 | 54 | Raven.setDataCallback(function(data, original) { |
54 | | - // We only care about mutating an exception |
55 | | - var exception = data.exception; |
56 | | - if (exception) { |
57 | | - exception = exception.values[0]; |
58 | | - var matches = angularPattern.exec(exception.value); |
59 | | - |
60 | | - if (matches) { |
61 | | - // This type now becomes something like: $rootScope:inprog |
62 | | - exception.type = matches[1]; |
63 | | - exception.value = matches[2]; |
64 | | - data.message = exception.type + ': ' + exception.value; |
65 | | - // auto set a new tag specifically for the angular error url |
66 | | - data.extra.angularDocs = matches[3].substr(0, 250); |
67 | | - } |
68 | | - } |
| 55 | + angularPlugin._normalizeData(data); |
| 56 | + |
69 | 57 | original && original(data); |
70 | 58 | }); |
71 | 59 | } |
72 | 60 |
|
| 61 | +angularPlugin._normalizeData = function (data) { |
| 62 | + // We only care about mutating an exception |
| 63 | + var exception = data.exception; |
| 64 | + if (exception) { |
| 65 | + exception = exception.values[0]; |
| 66 | + var matches = angularPattern.exec(exception.value); |
| 67 | + |
| 68 | + if (matches) { |
| 69 | + // This type now becomes something like: $rootScope:inprog |
| 70 | + exception.type = matches[1]; |
| 71 | + exception.value = matches[2]; |
| 72 | + |
| 73 | + data.message = exception.type + ': ' + exception.value; |
| 74 | + // auto set a new tag specifically for the angular error url |
| 75 | + data.extra.angularDocs = matches[3].substr(0, 250); |
| 76 | + } |
| 77 | + } |
| 78 | +}; |
| 79 | + |
73 | 80 | module.exports = angularPlugin; |
74 | 81 |
|
75 | 82 | },{}]},{},[1])(1) |
|
0 commit comments