Skip to content

Commit

Permalink
fix error stack trace
Browse files Browse the repository at this point in the history
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>
  • Loading branch information
simvalery committed Aug 30, 2023
1 parent 75a0070 commit fc2e6d5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api-gateway/src/api/service/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ export class AccountApi {
try {
await checkPermission(UserRole.STANDARD_REGISTRY)(user);
} catch (error) {
new Logger().error(error, ['API_GATEWAY']);
throw error;
new Logger().error(error.message, ['API_GATEWAY']);
throw new HttpException(error.message, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
try {
Expand All @@ -132,7 +132,7 @@ export class AccountApi {
if (error.message.includes('already exists')) {
throw new HttpException('An account with the same name already exists.', HttpStatus.INTERNAL_SERVER_ERROR);
}
throw error;
throw new HttpException(error.message, HttpStatus.INTERNAL_SERVER_ERROR);
}
}

Expand Down Expand Up @@ -163,8 +163,8 @@ export class AccountApi {
const {username, password} = body;
return await users.generateNewToken(username, password) as any;
} catch (error) {
new Logger().error(error, ['API_GATEWAY']);
throw error;
new Logger().warn(error.message, ['API_GATEWAY']);
throw new HttpException(error.message, HttpStatus.UNAUTHORIZED);
}
}

Expand Down

0 comments on commit fc2e6d5

Please sign in to comment.