Skip to content

Commit

Permalink
fix(api): only log 5xx errors
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Sep 21, 2023
1 parent 7d061ad commit 15cb866
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/src/utils/http-exception.filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import * as Rollbar from 'rollbar';

@Catch(HttpException)
export class HttpExceptionFilter implements ExceptionFilter {
private readonly ignoredCodes = [401, 404];
private rollbar: Rollbar;

constructor(@Inject(ROLLBAR_CONFIG) private rollbarConfig) {
Expand All @@ -24,7 +23,9 @@ export class HttpExceptionFilter implements ExceptionFilter {
const request = ctx.getRequest<Request>();
const status = exception.getStatus();

if (this.rollbar && !this.ignoredCodes.includes(status)) {
const isValidStatusCode = status >= 500;

if (this.rollbar && isValidStatusCode) {
this.rollbar.error(exception);
}

Expand Down

0 comments on commit 15cb866

Please sign in to comment.