Skip to content

Commit

Permalink
feat(CB2-14307): corect error message chack
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-Searle committed Oct 14, 2024
1 parent 6dfa153 commit f462e12
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const handler = async (

callback(null, 'Data processed successfully.');
} catch (error) {
if (error.body) {
if (error.message) {
logger.error(JSON.stringify(error.message));
callback(
null,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('Application entry', () => {

it('should handle an error when sending the object', async () => {
process.env.SEND_TO_SMC = 'True';
const expectedErrorMessage = 'Data processed unsuccessfully: Error: Oh no!';
const expectedErrorMessage = `Data processed unsuccessfully: ${JSON.stringify('Oh no!')}`;
jest.mocked(sendMCProhibition).mockRejectedValue(new Error('Oh no!'));

await handler(event, null, (error, result) => {
Expand Down

0 comments on commit f462e12

Please sign in to comment.