2

Can we get any error information from an image load failure? I have the following:

Image image = new Image(imagePath);
image.addErrorHandler(new ErrorHandler() {
    Override
    public void onError(ErrorEvent event) {
        // what can we print here from 'event'?
    }
});

I have an image that fails to load once in awhile, and I just tried letting the event.toString() method print itself, but I just get something like:

println("Error!: " + event);
// "Error: An event type"

so I'm not sure why the image fails to load,

Thank you

user291701
  • 38,411
  • 72
  • 187
  • 285
  • Sorry. I don't think that you can do that. The ErrorEvent just contains 'error' as a static text. – tommueller Dec 01 '12 at 16:28
  • why don't you check firebug? The console usually prints out this kind of errors or if you right click on the image, it may tell you if you are getting a resource not found or something – fernandohur Dec 01 '12 at 19:24
  • Hi, the problem is that I'm experiencing this at runtime on a mobile device. So I need to save some logs to a buffer and check them manually. So need a way to store what exactly happened. – user291701 Dec 01 '12 at 20:32

1 Answers1

1

Currently you can't know what caused the error, but you can know what type of error caused it and it gives fairly a good idea on what might have gone wrong

 event.getAssociatedType();

OR

  event.getType();
Abhijith Nagaraja
  • 3,370
  • 6
  • 27
  • 55