Provide more accurate and descriptive image optimization error messages
cURL error 28 / timeouts during optimization often cause an error message that users are out of credit/quota.
This can often cause them to frustrated because they either should have unlimited quota or should still have plenty left.
Can also cause the users to upgrade their subscription and to become even more frustrated when that doesn't work either.
Potential Solution Provide more accurate and descriptive error messages depending on what exactly is causing the errors.
Some further explanation: https://wp-media.slack.com/archives/G045P1RA2/p1638565375003000
Cannot reproduce. Tried spoofing a cURL errors and forcing timeouts, and returning various WP_Errors from the Imagify User class, but was only able to get (1) the appropriate "Our server returned an invalid response" message or (2) the optimize breaks without returning any message at all.
Per slack conversation: Seems that the way to reproduce it is: Small WP memory limit (40M) 30s PHP timeout Server using Imagick Try to optimize a lot of larger images (2MB+), especially when your site has a lot of thumbnails defined (props to @markonikolic985)
@piotrbak @joejoe04 What can be the different messages to display?
@GeekPress Not sure what kind of errors can we expect there further, but starting from having two separate errors sounds like a good idea:
- For out of quota
- For the timeouts
For the timeout, we could have the following:
The operation timed out while processing your image. Please try again, if the problem still exists, please check our documentation for possible solutions: https://imagify.io/documentation/optimization-is-stuck/
I agree with @piotrbak that 2 primary ones are for out of quota and timeouts, though I think it could also be helpful if the error messages could also distinguish between timeouts and 403s (whether blocked by security plugins, firewall, HTTP authentication, etc). If so, we could offer more accurate advice about what needs to be checked.
The biggest issue in my opinion (and the reason I remember opening this issue) is that sometimes when timeouts occur, it causes the "Out of quota" message to show to the users. That really upsets some people because they have ordered the Infinite plan and then suddenly they're told they are out of quota, when the issue is really something else (cURL error 28, etc).
I believe Caspar had checked into why this happens just before he left. I don't know why it happens, but I remember he said it was a bit complicated.