diff --git a/src/users/controllers/users.controller.ts b/src/users/controllers/users.controller.ts index 2e6eabdadfa83a1dee853243c6b0be1aa95dd923..7a4d242e780772112aa82826b65422b78f068c9b 100644 --- a/src/users/controllers/users.controller.ts +++ b/src/users/controllers/users.controller.ts @@ -197,7 +197,11 @@ export class UsersController { @Get(':id') @ApiParam({ name: 'id', type: String, required: true }) public async getUser(@Param() params): Promise<IUser> { - return this.usersService.findById(params.id); + const user = await this.usersService.findById(params.id); + if (!user) { + throw new HttpException('User does not exist', HttpStatus.NOT_FOUND); + } + return user; } @ApiResponse({ status: HttpStatus.CREATED, description: 'Description updated' })