Commit 9f2292ea authored by Piotr Gawron's avatar Piotr Gawron
Browse files

when type of the argument is wrong return 400

parent 1ea69afe
...@@ -14,6 +14,7 @@ import org.springframework.web.HttpMediaTypeNotSupportedException; ...@@ -14,6 +14,7 @@ import org.springframework.web.HttpMediaTypeNotSupportedException;
import org.springframework.web.bind.MissingServletRequestParameterException; import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.ServletRequestBindingException; import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
...@@ -41,7 +42,8 @@ public abstract class BaseController { ...@@ -41,7 +42,8 @@ public abstract class BaseController {
} else if (e instanceof QueryException } else if (e instanceof QueryException
|| e instanceof HttpMessageNotReadableException || e instanceof HttpMessageNotReadableException
|| e instanceof MissingServletRequestParameterException || e instanceof MissingServletRequestParameterException
|| e instanceof HttpMediaTypeNotSupportedException) { || e instanceof HttpMediaTypeNotSupportedException
|| e instanceof MethodArgumentTypeMismatchException) {
logger.error(e, e); logger.error(e, e);
return createErrorResponse("Query server error.", e.getMessage(), new HttpHeaders(), HttpStatus.BAD_REQUEST); return createErrorResponse("Query server error.", e.getMessage(), new HttpHeaders(), HttpStatus.BAD_REQUEST);
} else if (e instanceof ServletRequestBindingException && e.getMessage().contains(Configuration.AUTH_TOKEN)) { } else if (e instanceof ServletRequestBindingException && e.getMessage().contains(Configuration.AUTH_TOKEN)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment