Bad error handling
While using this bundle, I often get following error:
Error: Method Gregwar\ImageBundle\ImageHandler::__toString() must not throw an exception in D:\Projects\webberig\app\cache\dev\classes.php line 0
The cause is usually a simple problem. The image file doesn't exist, the cache folder doesn't exist, etc... The problem is that the actual error is nowhere to be found and the execution of the page is interrupted.
I suggest the following solution:
- Catch the exception (ie. inside the Image::guess method) and provide a fallback value (an error page that returns a 404 error) or perhaps a base64 string with a grey image
- Log the exception using the logger service
Hi, and thanks for reporting
This issue was already discussed #9
However the idea of logging it in the logger was not proposed, and I like it
If we add fallback images, I think that it should be optional and display a clearly "error" string in the image
+1 for this.
It's frustrating having no explanation of the error.