Opened 12 years ago

Closed 11 years ago

#2680 closed enhancement (fixed)

dojo.io.bind error handling model needs change

Reported by: tjerk@… Owned by: alex
Priority: high Milestone: 1.2
Component: IO Version: 0.4.2
Keywords: dojo bind ajax error handling Cc:
Blocked By: Blocking:

Description (last modified by James Burke)

One calls dojo.io.bind with an object argument that defines a load and error function.

Now when the load function throws an error dojo sees this as a failed AjaxRequest? and calls the error function.

Dojo should treat errors thrown in the load function as normal program errors and it should not catch this error.

Example code:

dojo.io.bind({
    url: action,
    encoding: "utf-8",
    load: function(type, data, e) {
          
          throw "SomeError";
          
    },
    error: function(type, error) {
            alert(error.message);
    }
    mimetype: "text/xml"
  });

The error thrown in load is catched and the error function is called.

I think it should report the error to the browser. ( thus not catch it ). This is better because now we can do some debugging if some unespected error occured in a load function.

PS: In previous versions of dojo I had no problems

Change History (2)

comment:1 Changed 11 years ago by dylan

Milestone: 1.2
Priority: highestnormal

comment:2 Changed 11 years ago by James Burke

Description: modified (diff)
Resolution: fixed
Status: newclosed

This is "fixed" in a way in Dojo 1.2. Now, with djConfig.isDebug = true, the errors are thrown and not caught. They are only caught now in the djConfig.isDebug false case.

Note: See TracTickets for help on using tickets.