エラーのステータスコードを修正

This commit is contained in:
saito.k 2023-07-13 16:50:47 +09:00
parent 14627ad7e9
commit 8c8fa4dc6b
2 changed files with 10 additions and 6 deletions

View File

@ -1594,7 +1594,7 @@ describe('checkin', () => {
const service = module.get<TasksService>(TasksService);
await expect(service.checkin(1, 'typist-user-external-id')).rejects.toEqual(
new HttpException(makeErrorResponse('E010603'), HttpStatus.BAD_REQUEST),
new HttpException(makeErrorResponse('E010603'), HttpStatus.NOT_FOUND),
);
});
});
@ -1741,7 +1741,7 @@ describe('suspend', () => {
const service = module.get<TasksService>(TasksService);
await expect(service.checkin(1, 'typist-user-external-id')).rejects.toEqual(
new HttpException(makeErrorResponse('E010603'), HttpStatus.BAD_REQUEST),
new HttpException(makeErrorResponse('E010603'), HttpStatus.NOT_FOUND),
);
});
});
@ -2020,7 +2020,7 @@ describe('cancel', () => {
await expect(
service.cancel(1, 'typist-user-external-id', ['typist', 'standard']),
).rejects.toEqual(
new HttpException(makeErrorResponse('E010603'), HttpStatus.BAD_REQUEST),
new HttpException(makeErrorResponse('E010603'), HttpStatus.NOT_FOUND),
);
});
});

View File

@ -184,6 +184,10 @@ export class TasksService {
HttpStatus.BAD_REQUEST,
);
case TasksNotFoundError:
throw new HttpException(
makeErrorResponse('E010601'),
HttpStatus.NOT_FOUND,
);
case AccountNotMatchError:
case StatusNotMatchError:
throw new HttpException(
@ -228,7 +232,7 @@ export class TasksService {
case TasksNotFoundError:
throw new HttpException(
makeErrorResponse('E010603'),
HttpStatus.BAD_REQUEST,
HttpStatus.NOT_FOUND,
);
case StatusNotMatchError:
case TypistUserNotMatchError:
@ -279,7 +283,7 @@ export class TasksService {
case TasksNotFoundError:
throw new HttpException(
makeErrorResponse('E010603'),
HttpStatus.BAD_REQUEST,
HttpStatus.NOT_FOUND,
);
case StatusNotMatchError:
case TypistUserNotMatchError:
@ -325,7 +329,7 @@ export class TasksService {
case TasksNotFoundError:
throw new HttpException(
makeErrorResponse('E010603'),
HttpStatus.BAD_REQUEST,
HttpStatus.NOT_FOUND,
);
case StatusNotMatchError:
case TypistUserNotMatchError: