Skip to content

fix: Handle undefined or null errors - #1223

Merged
seb-cr merged 3 commits into
masterfrom
ENG-4917/handle-undefined-error
Jul 21, 2026
Merged

fix: Handle undefined or null errors#1223
seb-cr merged 3 commits into
masterfrom
ENG-4917/handle-undefined-error

Conversation

@seb-cr

@seb-cr seb-cr commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Thrown errors or promise rejections should always be an instance of Error in best practice, however we found a couple of places recently where a promise was being rejected with undefined. Lambda Wrapper's error handling failed with a TypeError:

TypeError: Cannot destructure property 'code' of 'error' as it is undefined.
    at Function.handleError (/var/task/node_modules/@comicrelief/lambda-wrapper/src/core/LambdaWrapper.ts:185:7)
    at wrapper (/var/task/node_modules/@comicrelief/lambda-wrapper/src/core/LambdaWrapper.ts:98:39)

Lambda Wrapper should gracefully handle any kind of error thrown at it.

Jira: ENG-4917

@seb-cr
seb-cr requested a review from curlyfriesplease July 20, 2026 18:30
@seb-cr
seb-cr merged commit 2e83df7 into master Jul 21, 2026
6 checks passed
@seb-cr
seb-cr deleted the ENG-4917/handle-undefined-error branch July 21, 2026 11:45
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.1.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants