Skip to content
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

Exception message is hidden #398

Merged
merged 2 commits into from
Jun 25, 2024
Merged

Exception message is hidden #398

merged 2 commits into from
Jun 25, 2024

Conversation

AidasK
Copy link
Contributor

@AidasK AidasK commented Jun 25, 2024

It took too long to find a cause of a not working cache setup. The real issue was wrong bucket setup:

Unable to write file at location: a. {
  "error": {
    "code": 400,
    "message": "Cannot insert legacy ACL for an object when uniform bucket-level access is enabled. Read more at https://cloud.google.com/storage/docs/uniform-bucket-level-access",
    "errors": [
      {
        "message": "Cannot insert legacy ACL for an object when uniform bucket-level access is enabled. Read more at https://cloud.google.com/storage/docs/uniform-bucket-level-access",
        "domain": "global",
        "reason": "invalid"
      }
    ]
  }
}.

So exceptions should not be hidden as they do help to solve the problem easier.

@mantasekom
Copy link

It would be really nice to have this fix.

src/Server.php Outdated
@@ -689,7 +689,7 @@ public function makeImage($path, array $params)
$this->api->run($tmp, $this->getAllParams($params))
);
} catch (FilesystemV2Exception $exception) {
throw new FilesystemException('Could not write the image `'.$cachedPath.'`.');
throw new FilesystemException('Could not write the image `'.$cachedPath.'`. ' . $exception->getMessage());
Copy link

@Art4 Art4 Jun 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not directly inserting the catched exception?

Suggested change
throw new FilesystemException('Could not write the image `'.$cachedPath.'`. ' . $exception->getMessage());
throw new FilesystemException('Could not write the image `'.$cachedPath.'`. '.$exception->getMessage(), 0, $exception);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, updated!

@ADmad ADmad merged commit e9c5eba into thephpleague:master Jun 25, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants