Skip to content

Commit

Permalink
feat: better support unhandled errors
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau committed Feb 6, 2021
1 parent dae9b69 commit b666145
Show file tree
Hide file tree
Showing 45 changed files with 105 additions and 84 deletions.
6 changes: 3 additions & 3 deletions docs/classes/nightingale_sentry_src.default.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/christophehurpeau/nightingale/blob/master/packages/nightingale-sentry/src/index.ts#L105">nightingale-sentry/src/index.ts:105</a></li>
<li>Defined in <a href="https://github.com/christophehurpeau/nightingale/blob/master/packages/nightingale-sentry/src/index.ts#L106">nightingale-sentry/src/index.ts:106</a></li>
</ul>
</aside>
<h4 class="tsd-type-parameters-title">Type parameters</h4>
Expand Down Expand Up @@ -150,7 +150,7 @@ <h3>handle</h3>
<div class="tsd-signature tsd-kind-icon">handle<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Handle</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/christophehurpeau/nightingale/blob/master/packages/nightingale-sentry/src/index.ts#L105">nightingale-sentry/src/index.ts:105</a></li>
<li>Defined in <a href="https://github.com/christophehurpeau/nightingale/blob/master/packages/nightingale-sentry/src/index.ts#L106">nightingale-sentry/src/index.ts:106</a></li>
</ul>
</aside>
</section>
Expand All @@ -160,7 +160,7 @@ <h3>min<wbr>Level</h3>
<div class="tsd-signature tsd-kind-icon">min<wbr>Level<span class="tsd-signature-symbol">:</span> <a href="../enums/nightingale_types_src.level.html" class="tsd-signature-type" data-tsd-kind="Enumeration">Level</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/christophehurpeau/nightingale/blob/master/packages/nightingale-sentry/src/index.ts#L103">nightingale-sentry/src/index.ts:103</a></li>
<li>Defined in <a href="https://github.com/christophehurpeau/nightingale/blob/master/packages/nightingale-sentry/src/index.ts#L104">nightingale-sentry/src/index.ts:104</a></li>
</ul>
</aside>
</section>
Expand Down
10 changes: 5 additions & 5 deletions packages/nightingale-sentry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ import {
import { configure, Level, listenUnhandledErrors } from 'nightingale';
import SentryHandler from 'nightingale-sentry';

if (process.env.NODE_ENV !== 'production') {
listenUnhandledErrors();
}
listenUnhandledErrors();

sentryInit({
dsn: process.env.NODE_ENV === 'production' ? '__DSN__' : undefined,
Expand All @@ -44,7 +42,7 @@ configure([
{ addBreadcrumb, captureException, captureMessage },
Level.ERROR,
{
// shouldSendAsException: (record) => record.metadata?.error !== undefined,
// shouldSendAsException: (record) => record.metadata?.error !== undefined && record.metadata.unhandled !== true,
// shouldSendAsBreadcrumb: (record) => false,
// getUser: ({ context }) => context.user && { id: context.user.id },
// getTags: ({ context }) => context.tags,
Expand Down Expand Up @@ -110,7 +108,9 @@ configure([
Level.INFO,
{
shouldSendAsException: (record) =>
record.level >= Level.ERROR && record.metadata?.error !== undefined,
record.level >= Level.ERROR &&
record.metadata?.error !== undefined &&
record.metadata.unhandled !== true,
shouldSendAsBreadcrumb: (record) =>
record.metadata?.breadcrumb ? true : false,
getBreadcrumbCategory: (record) =>
Expand Down
2 changes: 1 addition & 1 deletion packages/nightingale-sentry/dist/index-browser-dev.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/nightingale-sentry/dist/index-browser-dev.es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b666145

Please sign in to comment.