Skip to content

Commit

Permalink
Only use error handler for web client exceptions for now
Browse files Browse the repository at this point in the history
  • Loading branch information
theotherp@gmx.de authored and theotherp@gmx.de committed Jan 7, 2018
1 parent 0dc315d commit b5f1aae
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions core/src/main/java/org/nzbhydra/web/ErrorHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.springframework.web.bind.MissingPathVariableException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.async.AsyncRequestTimeoutException;
Expand All @@ -52,7 +53,7 @@
import java.util.Set;
import java.util.stream.Collectors;

//@ControllerAdvice
@ControllerAdvice
@Component
//Do NOT extend ResponseEntityExceptionHandler or it won't work
public class ErrorHandler {
Expand All @@ -78,7 +79,21 @@ public class ErrorHandler {
);


@ExceptionHandler(value = {Exception.class})
@ExceptionHandler(value = { HttpRequestMethodNotSupportedException.class,
HttpMediaTypeNotSupportedException.class,
HttpMediaTypeNotAcceptableException.class,
MissingPathVariableException.class,
MissingServletRequestParameterException.class,
ServletRequestBindingException.class,
ConversionNotSupportedException.class,
TypeMismatchException.class,
HttpMessageNotReadableException.class,
HttpMessageNotWritableException.class,
MethodArgumentNotValidException.class,
MissingServletRequestPartException.class,
BindException.class,
NoHandlerFoundException.class,
AsyncRequestTimeoutException.class})
@ResponseBody
public ResponseEntity<Object> handleConflict(Exception ex, HttpServletRequest request) {
String fullParametersString = "";
Expand Down

0 comments on commit b5f1aae

Please sign in to comment.