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

Set Exception Value and Message of Event #4

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

rbnmulder
Copy link
Member

The event message was not properly returned and I also updated the exception value since that was still localized and could give the wrong message in Sentry.

Updating the exception value was based on feedback from getsentry/sentry-javascript#3204

@rbnmulder rbnmulder requested a review from indykoning July 21, 2023 10:26
@@ -34,6 +34,8 @@ public function execute(Observer $observer): void
if ($hint?->exception instanceof LocalizedException) {
$hintMessage = $hint->exception->getRawMessage();
$event->setMessage($hintMessage);
$event->getExceptions()[0]->setValue($hintMessage);
Copy link
Member

Choose a reason for hiding this comment

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

It may be a good idea to check if this index exists

Copy link
Member Author

Choose a reason for hiding this comment

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

@indykoning There should be at least one exception in the array. Sentry prepares the event and does the following checks before setting the exceptions on the event: https://github.com/getsentry/sentry-php/blob/master/src/Client.php#L244 and https://github.com/getsentry/sentry-php/blob/master/src/Client.php#L415C22-L415C41

I can add the check for the index to be sure.

@indykoning indykoning merged commit 7deced4 into justbetter:master Jul 26, 2023
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.

2 participants