-
Notifications
You must be signed in to change notification settings - Fork 436
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
Enhancement: use internal exception #462
Comments
Hello! Thanks for your feedback! I agree with your point, having generic exception is not handy at all to let users handle things properly. But I do not think this is something we will try implement in the current version of snappy as we are currently working on a v2 (see #467). For sure we will take your feedback into consideration for it. Nevertheless if you have time to propose a PR to enhance the current version I would be glad to review and merge it. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Also sometimes a pdf is generated when a RuntimeException is thrown during the checkProcessStatus method. There is no way to ignore the error and carry on with the process. Putting the checkOutput step before the checkProcessStatus and then optionally ignoring the checkProcessStatus if there is no output error would be beneficial. |
This library is currently throwing a generic
RuntimeException
when the pdf conversion fails, see the source code at https://github.com/KnpLabs/snappy/blob/master/src/Knp/Snappy/AbstractGenerator.php#L431This makes it hard for the users to properly react to such exceptions since they are forced to rely on the exception text message (which it's not even guaranteed to stay the same).
So, a possible nice enhancement could be adding an internal exception (extending
RuntimeException
, so it would be back-compatible)By the way, this library already uses this approach with
Knp\Snappy\Exception\FileAlreadyExistsException
I can provide a PR.
The text was updated successfully, but these errors were encountered: