feat: Default error code to HTTP status code.

This commit is contained in:
Ruben Verborgh
2021-07-14 15:17:58 +01:00
parent cc1e332394
commit b9295f00c2
4 changed files with 23 additions and 4 deletions

View File

@@ -63,6 +63,10 @@ describe('HttpError', (): void => {
expect(instance.errorCode).toBe(options.errorCode);
});
it('defaults to an HTTP-specific error code.', (): void => {
expect(new constructor().errorCode).toBe(`H${statusCode}`);
});
it('sets the details.', (): void => {
expect(instance.details).toBe(options.details);
});