Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/migration/v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ Rather than passing in a config object everywhere you use Lambda Wrapper, you no

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

Wrap options (the `throwError` parameter) are now passed in as an object.

Finally, there is no longer a `request` parameter provided to your wrapped function. You can get this from `di` if you need it.

Instead of this:
Expand Down Expand Up @@ -104,6 +106,18 @@ export default lambdaWrapper.wrap(async (di) => {
});
```

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.

```ts
// v1
export default LambdaWrapper(CONFIGURATION, handler, /* throwError */ true);

// v2 equivalent
export default lambdaWrapper.wrap(handler, {
handleUncaughtErrors: false,
});
```

If your project doesn't add any additional services to dependency injection, you can also now use `lambdaWrapper` straight out of the box:

```ts
Expand Down
Loading