Skip to content

Commit

Permalink
map AWS NoSuchKeyException to 404
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Aug 24, 2023
1 parent 3a09542 commit 60c9ace
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/io/cryostat/ExceptionMappers.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.jboss.resteasy.reactive.RestResponse;
import org.jboss.resteasy.reactive.server.ServerExceptionMapper;
import org.projectnessie.cel.tools.ScriptException;
import software.amazon.awssdk.services.s3.model.NoSuchKeyException;

public class ExceptionMappers {
@ServerExceptionMapper
Expand All @@ -42,4 +43,9 @@ public RestResponse<Void> mapValidationException(jakarta.validation.ValidationEx
public RestResponse<Void> mapScriptException(ScriptException ex) {
return RestResponse.status(HttpResponseStatus.BAD_REQUEST.code());
}

@ServerExceptionMapper
public RestResponse<Void> mapNoSuchKeyException(NoSuchKeyException ex) {
return RestResponse.status(HttpResponseStatus.NOT_FOUND.code());
}
}

0 comments on commit 60c9ace

Please sign in to comment.