stex icon indicating copy to clipboard operation
stex copied to clipboard

Add "stex.reportError" helper function

Open nullstyle opened this issue 10 years ago • 0 comments

It's come to my attention that in stellar-api we're forwarding any call to stex.error.log to sentry. This is not a good situation. It means that error reports in stellar-api are actually just log lines that alias most of the useful information encoded into a Error object. It seems that this solution was chosen because we did not have defined with stex a reusable system to report errors.

We should add this functionality at stex.reportError which should behave similar to the stex errors middleware: It logs as well as reports to sentry as peer operations, not dependent ones. From the code:

    var reportErrorDirectly = function(err) {
        log.error(err.message);
        // report to sentry if we are enabled
        if(sentry) {
            sentry.captureError(err);
        }
    };

I propose we extract that functionality to a method stex.reportError, such that the above code becomes:

    var reportErrorDirectly = function(err) {
        stex.reportError(err);
    };

nullstyle avatar Apr 21 '15 17:04 nullstyle