Ticket #2680 (closed enhancement: fixed)

Opened 16 months ago

Last modified 4 days ago

dojo.io.bind error handling model needs change

Reported by: tjerk@… Owned by: alex
Priority: normal Milestone: 1.2
Component: IO Version: 0.4.2
Severity: major Keywords: dojo bind ajax error handling
Cc:

Description (last modified by jburke) (diff)

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

Changed 5 months ago by dylan

  • priority changed from highest to normal
  • milestone set to 1.2

Changed 4 days ago by jburke

  • status changed from new to closed
  • resolution set to fixed
  • description modified (diff)

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.