Skip to content

Commit

Permalink
fix(lambda-nodejs): handler filename missing from error message (aws#…
Browse files Browse the repository at this point in the history
…14564)


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
otaviomacedo authored and hollanddd committed Aug 26, 2021
1 parent 2272883 commit b70bf49
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda-nodejs/lib/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function findEntry(id: string, entry?: string): string {
return jsHandlerFile;
}

throw new Error('Cannot find entry file.');
throw new Error(`Cannot find handler file ${tsHandlerFile} or ${jsHandlerFile}`);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda-nodejs/test/function.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ test('throws when entry does not exist', () => {
});

test('throws when entry cannot be automatically found', () => {
expect(() => new NodejsFunction(stack, 'Fn')).toThrow(/Cannot find entry file./);
expect(() => new NodejsFunction(stack, 'Fn')).toThrow(/Cannot find handler file .*function.test.Fn.ts or .*function.test.Fn.js/);
});

test('throws with the wrong runtime family', () => {
Expand Down

0 comments on commit b70bf49

Please sign in to comment.