Page MenuHomePhabricator

Make sure async wrapping for Javascript error logging only happens when the call is truly async
Closed, DeclinedPublic

Description

There are some jQuery operations that can be either sync or async, e.g. $.ajax. If we apply error logging in the sync case, that means we will report errors multiple times and might even report errors that the application code handles safely. Made-up example:

try {
    $.ajax( '/endpoint.php', { async: false } ).done( function ( data ) {
        if ( !data ) {
            throw new Error( 'API call failed' );
        }
    } );
} catch (e) {
    alert( 'API call failed, please try again later' );
}

This error should not be reported since the application code already deals with it.

Other potentially problematic methods beyond $.ajax are $.event.add for synthetic events, and $.ready when the page already finished loading.

Related Objects

StatusSubtypeAssignedTask
OpenNone
DeclinedNone
DeclinedTgr
Resolvedjlinehan
DeclinedNone
DeclinedNone
ResolvedTgr
ResolvedGilles
ResolvedTgr
ResolvedTgr
Resolvedcsteipp
ResolvedTgr
DeclinedTgr
DeclinedTgr
ResolvedTgr
ResolvedTgr
ResolvedTgr
ResolvedTgr
Resolvedjcrespo
ResolvedAklapper
ResolvedTgr
ResolvedTgr

Event Timeline

Tgr claimed this task.
Tgr raised the priority of this task from to Needs Triage.
Tgr updated the task description. (Show Details)
Tgr added projects: Sentry, JavaScript.
Tgr added a subscriber: Tgr.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Tgr changed the task status from Open to Stalled.Mar 25 2015, 11:39 PM

Abandoned for now, see T92247#1147500.

Tgr triaged this task as Medium priority.Apr 3 2015, 7:02 AM

At the time of creating this task it was assumed that the server side implementation of error logging would be based on Sentry. We have eventually decided on a different implementation, so de-tagging.

@Tgr: In which codebase would this have to get implemented? Asking as this task lacks a codebase project tag.

Boldly declining after 5.5 years of being stalled and looking at the dependency tree.
Feel free to reopen and assign an active project tag if this is still wanted. Thanks!