Page MenuHomePhabricator

Make sure async wrapping for Javascript error logging only happens when the call is truly async
Open, Stalled, NormalPublic

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

StatusAssignedTask
OpenNone
OpenNone
OpenTgr
OpenNone
OpenTgr
StalledNone
ResolvedTgr
ResolvedGilles
OpenTgr
ResolvedTgr
Resolvedcsteipp
ResolvedTgr
DeclinedTgr
StalledTgr
ResolvedTgr
ResolvedTgr
ResolvedTgr
ResolvedTgr
OpenNone
Resolvedjcrespo
ResolvedAklapper
ResolvedTgr
ResolvedTgr

Event Timeline

Tgr created this task.Mar 20 2015, 6:18 PM
Tgr updated the task description. (Show Details)
Tgr raised the priority of this task from to Needs Triage.
Tgr claimed this task.
Tgr added projects: Sentry, JavaScript.
Tgr added a subscriber: Tgr.
Restricted Application added a project: Multimedia. · View Herald TranscriptMar 20 2015, 6:18 PM
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 Normal priority.Apr 3 2015, 7:02 AM