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#L431
This 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.
This library is currently throwing a generic
RuntimeExceptionwhen 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\FileAlreadyExistsExceptionI can provide a PR.