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

@php-wasm/logger event.reason is sometimes undefied #1149

Closed
bgrgicak opened this issue Mar 28, 2024 · 0 comments · Fixed by #1150
Closed

@php-wasm/logger event.reason is sometimes undefied #1149

bgrgicak opened this issue Mar 28, 2024 · 0 comments · Fixed by #1150
Assignees
Labels
[Aspect] Website [Type] Bug An existing feature does not function as intended

Comments

@bgrgicak
Copy link
Collaborator

The logUnhandledRejections code assumes that event.reason.stack always exists, but we found a case where event.reason was undefined.

This can be recreated by opening this URL in Firefox.

If event.reason isn't available, we should log the data we have available.

@bgrgicak bgrgicak self-assigned this Mar 28, 2024
@bgrgicak bgrgicak added [Type] Bug An existing feature does not function as intended [Aspect] Website labels Mar 28, 2024
@bgrgicak bgrgicak added this to the Zero Crashes milestone Mar 28, 2024
bgrgicak added a commit that referenced this issue Mar 29, 2024
Fixes #1149

## What is this PR doing?

Checks if `event.reason` or `event.reason.stack` exist in
`logUnhandledRejection`.

## What problem is it solving?

Fixes a JS error when a promise without a reason is thrown.

## How is the problem addressed?

By checking if a reason is provided.

## Testing Instructions

- Checkout this branch
- Start Playground `npm run dev`
- Open Playground and execute this in the browser console
```
Promise.reject();
```
- Confirm that logger doesn't throw an error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Aspect] Website [Type] Bug An existing feature does not function as intended
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant