Shane O'Sullivan's technical blog… really ties the room together

Error handler being wrongly invoked in callback to

Posted by Shane O'Sullivan on October 31, 2006

I’ve seen behaviour when using Dojo‘s ajax request handler where a valid response is returned, but it’s error handler is called. This seemed to be an error on Dojo’s part, as all the headers were correct (set to 200 and the correct content type, “text/plain”), but after much frustration, I stumbled on the answer – the load method was being called, but an exception was being thrown. The Dojo code seems to wrap the load method in a try/catch block, and if an exception is thrown, the error function is then called.

So, if you see you error functions being called when they shouldn’t be, stick a try/catch block inside your load function to see if that’s the problem.


4 Responses to “Error handler being wrongly invoked in callback to”

  1. JP said

    Thanks you SO MUCH for that post, saved my day….


  2. You’re very welcome, we aim to please 🙂

  3. MD said

    Thank you! You saved my day too!

  4. Happy to be of help – it’s a nasty little error to catch isn’t it?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: