-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image::Convert()
shows error in frontend instead of returning null
#656
Comments
Image::Convert()
shows error in frontend insteaf of failing silentlyImage::Convert()
shows error in frontend instead of failing silently
Couple of questions:
|
(Apart from that, the comment for
, but |
How do you get into that situation?
What's the reason for the failure? Is it some intermittent problem, or is it a misconfiguration, or something else?
That's actually a good argument. Looking back at the PR: #595 (comment) The
Is the error logger somehow causing an error to be thrown? Will using the default logger still log to all places that the error logger logs to? |
You tell me. ;) I have some older sites that have been upgraded a few times over time. It just happens, I guess.
The reason doesn't matter. The converter throws a Maybe there should be two different exceptions to be thrown for intermittent and permanent errors?
right. that would make sense and would be in line with all other manipulations.
The default logger logs to the log file. the error logger halts execution and AFAIK there is no way to redirect it to just a log file. I don't understand why there are two loggers anyway. |
Image::Convert()
shows error in frontend instead of failing silentlyImage::Convert()
shows error in frontend instead of returning null
I don't understand what is wrong with the submitted pull request. Not throwing an exception, and returning null, sounds like a sensible solution I get these errors when a user uploads a file with a long name within upload limits - the resampled filename, however, is too long for the filesystem
In my opinion, that's not a developer problem. It's a content issue and front-end users bear that impact. Silently logging and returning nothing should be the way to go. Developers can still be alerted and fix the problem when there's time and budget to do so. In this case, developers can simply tell the content author to rename their file and try again. |
The problem with the submitted pull request is there's no explanation of why the logger that's currently being used is incorrect. It feels like there's an underlying problem with that logger which is being ignored. If that logger should not be used directly, then documentation needs to be updated to explicitly mention that (and give the reason why), and we need to check if we're incorrectly using it anywhere else - not just this one location. |
Module version(s) affected
2.3.0
Description
When the conversion of an image fails, the error logger shows the error output on the page.
I think the conversion should fail silently and just log the error, not show it on the page.
How to reproduce
add
to the first line of
InterventionImageFileConverter::convert()
Possible Solution
use default logger instead of error logger in https://github.com/silverstripe/silverstripe-assets/blob/2/src/ImageManipulation.php#L728
instead of
Additional Context
No response
Validations
silverstripe/installer
(with any code examples you've provided)The text was updated successfully, but these errors were encountered: