diff --git a/docs/migration/v2.md b/docs/migration/v2.md index 0107002..10ee469 100644 --- a/docs/migration/v2.md +++ b/docs/migration/v2.md @@ -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: @@ -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