Changes between Initial Version and Version 1 of Ticket #9500


Ignore:
Timestamp:
Jul 3, 2009, 9:37:39 PM (13 years ago)
Author:
Eugene Lazutkin
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #9500

    • Property Cc Eugene Lazutkin added
    • Property Owner changed from anonymous to James Burke
  • Ticket #9500 – Description

    initial v1  
    11Hi,
    22
    3 I'm using xhr-deferreds and each time I call .cancel(), and error gets logged.
    4 I tried providing my errorHandler but without success.
     3I'm using xhr-deferreds and each time I call .cancel(), and error gets logged. I tried providing my errorHandler but without success.
    54
    6 I found the explanation.
    7 in dojo.js (full uncompressed file), dojo.xhr() automatically register '_deferError' as first errback, which single purpose is to log the error within console:
    8        var _deferError = function(/*Error*/error, /*Deferred*/dfd){
    9                //summary: errHandler function for dojo._ioSetArgs call.
     5I found the explanation in dojo.js (full uncompressed file), {{{dojo.xhr()}}} automatically register {{{_deferError}}} as first {{errback}}}, which single purpose is to log the error within console:
    106
    11                console.error(error);
    12                return error;
    13        }
     7{{{
     8#!js
     9var _deferError = function(/*Error*/error, /*Deferred*/dfd){
     10  //summary: errHandler function for dojo._ioSetArgs call.
     11  console.error(error);
     12  return error;
     13}
     14}}}
    1415
    1516As being trapped in a closure, we currently cannot prevent its
    16 registration, and since it's the first errback to be registered, it is the first to be triggered upon error.
     17registration, and since it's the first {{{errback}}} to be registered, it is the first to be triggered upon error.
    1718
    1819I understand why this is useful (it's pretty handy to have first
    19 errback log your error within console automatically) but I don't understand why we cannot make error logging optional.
     20{{{errback}}} log your error within console automatically) but I don't understand why we cannot make error logging optional.
    2021
    21 In my case, when I call cancel, I don't want any error to be logged, since in these cases, I don't consider cancelling my deferred being an error.
     22In my case, when I call cancel, I don't want any error to be logged, since in these cases, I don't consider canceling my deferred being an error.
    2223
    2324I've enclosed diff files against last revision (18640) that would allow to make error logging optional.