jamielesouef / angular-trackjs Goto Github PK
View Code? Open in Web Editor NEWTrackJS angular exception decorator
License: MIT License
TrackJS angular exception decorator
License: MIT License
In the exceptionHandlerDecorator
if ($window.trackJs) {
$window.trackJs.track(exception);
}
$delegate(exception, cause);
the exception is sent to TrackJs, but then passed to Angular via the $delegate(exception, cause);
line. This causes errors to be tracked twice - first by angular-trackjs, and then by the console.error
call in Angular's $ExceptionHandlerProvider
(console messages get picked up by TrackJS too).
Apart from duplicate logging, the issue with Angular's logging is that it appends the stack to the message, causing super long messages and thus non-working error detail URLs* in the current version of the TrackJS UI, as well as fragmentation of the error into multiple messages because the .toString() 'footprint' of the function that threw often varies in different environments and calling contexts.
Suggested fix
if ($window.trackJs) {
$window.trackJs.track(exception);
} else {
$delegate(exception, cause);
}
or drop the $delegate
line altogether,
to eat the error.
Thanks for the updates.
In validateError()
we currently check against payload.network[0]
, but e.g. in my case the network array contains more entries and my particular error is at index 1. Can we fix this?
The logError
variable in onError()
actually means "ignore error". Can it be renamed? It's quite confusing.
Could we add a criterium to ignore based on the URL of the page where the error occurred (not just based on the API URL)?
I'd like to do something like this:
{
statusCode: 401,
statusText: 'Unauthorized',
method: 'POST',
url: 'https://api.seek.com.au/v1/authenticate/jobseeker',
pageUrl: /.*\/login.*/
},
And then validateError()
would need to look similar to this (I just hacked it on to demonstrate):
angular.forEach(errorCriteria, function (errorTest, prop) {
if (errorTest instanceof RegExp) {
matchedCriteria.push(errorTest.test(prop === 'pageUrl' ? payload.url : networkResponse[prop]));
} else {
matchedCriteria.push(prop === 'pageUrl' ? errorTest === payload.url : errorTest === networkResponse[prop]);
}
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.