Skip to content

Commit

Permalink
handle NoSuchElementException as 404
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Feb 21, 2024
1 parent 74eebe3 commit dea97bd
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 @@ -15,6 +15,7 @@
*/
package io.cryostat;

import java.util.NoSuchElementException;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ExecutionException;

Expand Down Expand Up @@ -45,6 +46,11 @@ public RestResponse<Void> mapNoResultException(NoResultException ex) {
return RestResponse.notFound();
}

@ServerExceptionMapper
public RestResponse<Void> mapNoSuchElementException(NoSuchElementException ex) {
return RestResponse.notFound();
}

@ServerExceptionMapper
public RestResponse<Void> mapConstraintViolationException(ConstraintViolationException ex) {
logger.warn(ex);
Expand Down

0 comments on commit dea97bd

Please sign in to comment.