-
Notifications
You must be signed in to change notification settings - Fork 355
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
Introduce StorageFailure and FileNotFound exceptions #517
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much cleaner like this 👍
*/ | ||
class StorageFailure extends \RuntimeException implements Exception | ||
{ | ||
public static function unexpectedFailure($action, $args, \Exception $previous = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you type hint the $args
parameter (and also add a doc block) please ?
70f65ec
to
5a55c46
Compare
I added the missing phpdoc and typehint ;) |
5a55c46
to
faa268b
Compare
Thank you ! 👍 |
The main reason: it's currently impossible to know what's going wrong when one of the method fails. So rather than bad return values, I updated the Adapter API to throw exceptions.
So, this PR introduces two exceptions to be used by adapters:
Gaufrette\Exception\StorageFailure
andGaufrette\Exception\FileNotFound
. I implemented only AwsS3 for now and Filesystem methods would benefit from such overhauling (something likeFilesystemException
). But this patch has been done mostly to demonstrates what we could do to enhance the current API, more will come if this one is accepted.See #497.