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

docs: Better documentation for unhandled rejections warnings #1099

Merged
merged 2 commits into from Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -62,18 +62,16 @@ _Import name: `Sentry.Integrations.OnUnhandledRejection`_
This integration attaches global unhandled rejection handlers.

{% capture __alert_content -%}
This integration supresses default Node's warning about unhandled promise rejection. If you want to restore this behaviour, attach another handler using the snippet below.
This integration suppresses the default Node warning about unhandled promise rejection. If you want to restore this behavior, use the `--unhandled-rejections=warn` flag to run your code.
{%- endcapture -%}
{%- include components/alert.html
title="Note"
content=__alert_content
level="info"
%}

```js
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at:', p, 'reason:', reason);
});
```bash
$ node --unhandled-rejections=warn app.js
```

### LinkedErrors
Expand Down
13 changes: 13 additions & 0 deletions src/collections/_documentation/platforms/node/index.md
Expand Up @@ -6,6 +6,19 @@ title: Node.js

All our JavaScript-related SDKs provide the same API. Still, there are some differences between them which this section of the docs explains.

{% capture __alert_content -%}
The default configuration of the SDK captures unhandled promise rejections, which prevents Node.js from emitting default warnings about them. If you want to restore this behavior, use `--unhandled-rejections=warn` flag to run your code.
{%- endcapture -%}
{%- include components/alert.html
title="Note"
content=__alert_content
level="info"
%}

```bash
$ node --unhandled-rejections=warn app.js
```

## Integrations

All of our SDKs provide _Integrations_, similar to a plugin. All JavaScript SDKs provide default _Integrations_; please check details of a specific SDK to see which _Integrations_ it offers.
Expand Down