chore(api): improve log statements (#59992)

This commit is contained in:
Mrugesh Mohapatra
2025-04-25 16:04:03 +05:30
committed by GitHub
parent 464181b3b8
commit a905083bf8
4 changed files with 15 additions and 11 deletions

View File

@@ -170,7 +170,10 @@ describe('errorHandling', () => {
url: '/test'
});
expect(logSpy).toHaveBeenCalledWith(Error('a very bad thing happened'));
expect(logSpy).toHaveBeenCalledWith(
Error('a very bad thing happened'),
'Error in request'
);
});
it('should call fastify.log.warn when a bad request error occurs', async () => {
@@ -181,7 +184,10 @@ describe('errorHandling', () => {
url: '/test-bad-request'
});
expect(logSpy).toHaveBeenCalledWith(Error('a very bad thing happened'));
expect(logSpy).toHaveBeenCalledWith(
Error('a very bad thing happened'),
'CSRF error in request'
);
});
it('should NOT log when a CSRF error is thrown', async () => {