Skip to content

Commit 4ea3ec1

Browse files
committed
docs: Include wrap options in v2 migration guide
1 parent d2fb8b4 commit 4ea3ec1

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

docs/migration/v2.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ Rather than passing in a config object everywhere you use Lambda Wrapper, you no
7777

7878
v2 also drops support for callback-style async. Use promises instead.
7979

80+
Wrap options (the `throwError` parameter) are now passed in as an object.
81+
8082
Finally, there is no longer a `request` parameter provided to your wrapped function. You can get this from `di` if you need it.
8183

8284
Instead of this:
@@ -104,6 +106,18 @@ export default lambdaWrapper.wrap(async (di) => {
104106
});
105107
```
106108

109+
If using the `throwError` parameter, this needs to be replaced with the new `handleUncaughtErrors` wrap option. Note that the value should be negated; the new option's name better explains what Lambda Wrapper is doing, and needs the opposite value to select the same behaviour.
110+
111+
```ts
112+
// v1
113+
export default lambdaWrapper.wrap(CONFIGURATION, handler, /* throwError */ true);
114+
115+
// v2 equivalent
116+
export default lambdaWrapper.wrap(CONFIGURATION, handler, {
117+
handleUncaughtErrors: false,
118+
});
119+
```
120+
107121
If your project doesn't add any additional services to dependency injection, you can also now use `lambdaWrapper` straight out of the box:
108122

109123
```ts

0 commit comments

Comments
 (0)