Asset.image - Catch HTTP 500 Response

20 views
Skip to first unread message

Jed Leslie

unread,
May 7, 2014, 11:27:54 AM5/7/14
to mootool...@googlegroups.com
Hi Everybody - 

I'm using Asset.image to load a dynamically generated chart image.   Sometimes the image will be unable to load and will bubble up an exception explaining to the user why the chart failed with a HTTP 500 error response.  

Asset.image has an error event which passes the image into the error handler, but not the underlying response (and the error text I need to show the user).  

Before I go modifying the MooTools core, does anybody know of a supported way to get this response? 

Let me know if I'm being unclear.  Thanks in advance.

Jed

Aicke Schulz

unread,
May 8, 2014, 7:27:57 AM5/8/14
to mootool...@googlegroups.com
Hi,

I tried to get some useful informations from the native onerror: http://jsfiddle.net/yB3t8/
As far as I can see there is nothing useful in it. Maybe you can modify the example with your specific image url so you see if it will be different.

Aicke
--

---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mootools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dimitar Christoff

unread,
May 8, 2014, 1:09:11 PM5/8/14
to mootool...@googlegroups.com
this won't be intercepted. error can be anything but in the context of an image it just means src was set to something that isn't. only way to handle your use case is to get the images via Request and check response. onSuccess you can base64 the img src with the response or do whatever otherwise 
--
Dimitar Christoff

"JavaScript is to JAVA what hamster is to ham"
@D_mitar - https://github.com/DimitarChristoff

Jed Leslie

unread,
May 8, 2014, 2:16:28 PM5/8/14
to mootool...@googlegroups.com
As expected.  Thanks for the help!


On Thursday, May 8, 2014 1:09:11 PM UTC-4, Dimitar Christoff wrote:
this won't be intercepted. error can be anything but in the context of an image it just means src was set to something that isn't. only way to handle your use case is to get the images via Request and check response. onSuccess you can base64 the img src with the response or do whatever otherwise 

On Thursday, May 8, 2014, Aicke Schulz <aicke....@gmail.com> wrote:
Hi,

I tried to get some useful informations from the native onerror: http://jsfiddle.net/yB3t8/
As far as I can see there is nothing useful in it. Maybe you can modify the example with your specific image url so you see if it will be different.

Aicke

Am 07.05.2014 17:27, schrieb Jed Leslie:
Hi Everybody - 

I'm using Asset.image to load a dynamically generated chart image.   Sometimes the image will be unable to load and will bubble up an exception explaining to the user why the chart failed with a HTTP 500 error response.  

Asset.image has an error event which passes the image into the error handler, but not the underlying response (and the error text I need to show the user).  

Before I go modifying the MooTools core, does anybody know of a supported way to get this response? 

Let me know if I'm being unclear.  Thanks in advance.

Jed
--

---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mootools-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--

---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mootools-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages