Skip to content

Commit 6f99d5b

Browse files
J4YF7OJ4YMimatwawanaiker-barriocanal
authored
doc(aws-lambda): Add docs for captureAllSettledReasons option (#4374)
Co-authored-by: J4YM <[email protected]> Co-authored-by: Isabel <[email protected]> Co-authored-by: iker barriocanal <[email protected]>
1 parent 9e6ca29 commit 6f99d5b

File tree

1 file changed

+20
-0
lines changed
  • src/platforms/node/guides/aws-lambda

1 file changed

+20
-0
lines changed

src/platforms/node/guides/aws-lambda/index.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,26 @@ exports.handler = Sentry.AWSLambda.wrapHandler(yourHandler, {
8080
});
8181
```
8282

83+
84+
## Capture Rejected Promises in `Promise.allSettled`
85+
_(New in version 6.14.3)_
86+
87+
By default, Sentry captures errors raised by your handler.
88+
However, your handler might return a `Promise.allSettled` result.
89+
In this case, even if one of the messages has failed, Sentry won't capture any exception.
90+
91+
The `captureAllSettledReasons` (default: `false`) option captures all promise rejected results
92+
93+
```javascript {tabTitle:captureAllSettledReasons}
94+
exports.handler = Sentry.AWSLambda.wrapHandler(() => {
95+
return Promise.allSettled([
96+
Promise.rejected(new Error('first')),
97+
Promise.rejected(new Error('second')),
98+
]);
99+
}, { captureAllSettledReasons: true });
100+
// `first` and `second` errors are captured
101+
```
102+
83103
## Behavior
84104

85105
With the AWS Lambda integration enabled, the Node SDK will:

0 commit comments

Comments
 (0)