Skip to content

Exception message is hidden#398

Merged
ADmad merged 2 commits intothephpleague:masterfrom
AidasK:patch-1
Jun 25, 2024
Merged

Exception message is hidden#398
ADmad merged 2 commits intothephpleague:masterfrom
AidasK:patch-1

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
);
} 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
Contributor

@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
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