KnpLabs / KnpLabs/snappy

Enhancement: use internal exception

Open
#462 3 comments 1 reaction 2 assignees Claimed by @AntoineGonzalez View on GitHub
Scheduled for V2
Dominant language
PHP
Stars
4.5k
Forks
438
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.