Skip to content

Commit

Permalink
fix: better exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
astappiev committed Jun 3, 2024
1 parent 79da98c commit 71d2226
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package de.l3s.interweb.server.config;

import jakarta.validation.ValidationException;
import jakarta.ws.rs.core.Response;

import org.jboss.resteasy.reactive.RestResponse;
import org.jboss.resteasy.reactive.server.ServerExceptionMapper;

public class ExceptionMappers {
@ServerExceptionMapper
public RestResponse<String> mapValidationException(ValidationException x) {
return RestResponse.status(Response.Status.BAD_REQUEST, x.getMessage());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ public static Uni<List<Chat>> listByUser(Token token, String user, String order,
query += " AND user = :user";
}

if (page <= 0) {
page = 1; // foolproof
}

return find(query, sort, params).page(page - 1, perPage).list();
}

Expand Down
1 change: 1 addition & 0 deletions interweb-server/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ mp.jwt.verify.publickey.algorithm=HS256
quarkus.log.sentry=false
quarkus.log.sentry.dsn=
quarkus.log.sentry.in-app-packages=de.l3s.interweb
quarkus.log.sentry.ignored-exceptions-for-type=jakarta.validation.ValidationException

# OpenAPI, Swagger
quarkus.swagger-ui.always-include=true
Expand Down

0 comments on commit 71d2226

Please sign in to comment.