package org.gbif.ws.server.mapper;

import org.gbif.ws.WebApplicationException;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class WebApplicationExceptionMapper {

  @SuppressWarnings("rawtypes")
  @ExceptionHandler(WebApplicationException.class)
  public ResponseEntity handleWebApplicationException(WebApplicationException e) {
    return ResponseEntity
        .status(e.getStatus())
        .contentType(MediaType.TEXT_PLAIN)
        .body(e.getMessage());
  }
}

@@ -29,16 +29,54 @@
 apper;%0A%0A
+import org.gbif.ws.NotFoundException;%0A
 import o
@@ -697,11 +697,290 @@
 ());%0A  %7D
+%0A%0A  @SuppressWarnings(%22rawtypes%22)%0A  @ExceptionHandler(NotFoundException.class)%0A  public ResponseEntity handleNotException(NotFoundException e) %7B%0A    return ResponseEntity%0A        .status(e.getStatus())%0A        .contentType(MediaType.TEXT_PLAIN)%0A        .body(e.getMessage());%0A  %7D
 %0A%7D%0A

Add NotFoundException handler