-
Notifications
You must be signed in to change notification settings - Fork 60
chore: throw custom notfound exception #146
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
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Pull request overview
This PR introduces a custom NotFoundException for storage operations to enable more granular error handling when files or objects are not found. The exception replaces generic Exception throws in file-not-found scenarios, allowing calling code to distinguish between not-found errors and other types of failures.
Key Changes:
- Introduces new
NotFoundExceptionclass extendingException - Updates S3 device to parse XML error responses and throw
NotFoundExceptionfor NoSuchKey errors - Updates Local device's
read()method to throwNotFoundExceptioninstead of genericException
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Storage/Exception/NotFoundException.php | New exception class for file/object not-found scenarios |
| src/Storage/Device/S3.php | Adds parseAndThrowS3Error() method to parse S3 XML errors and throw NotFoundException for NoSuchKey; updates transfer() to throw NotFoundException |
| src/Storage/Device/Local.php | Imports and uses NotFoundException in the read() method instead of generic Exception |
| tests/Storage/S3Base.php | Critical Issue: Removes abstract getAdapterType() method declaration that is still being called and implemented |
Comments suppressed due to low confidence (1)
tests/Storage/S3Base.php:26
- Removing this abstract method declaration will break the test code. The method getAdapterType() is still being called on line 103 of this same file in the testType() method, and all child test classes (AWSTest, BackblazeTest, DOSpacesTest, LinodeTest, WasabiTest) have implementations of this method. Removing the abstract declaration will cause a fatal error when testType() is executed because the method won't be defined in the base class and PHP won't enforce its implementation in child classes.
*/
abstract protected function getAdapterDescription(): string;
/**
* @var S3
*/
protected $object = null;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f4607cc to
f8afc6d
Compare
No description provided.