Questions tagged [exceptionhandler]
186 questions
1
vote
0 answers
Spring Boot : handleMethodArgumentNotValid overriding not working for date format mismatch
I have an exception handler class that is working fine for validation failures.
The method handleMethodArgumentNotValid is not getting called for date type format mismatch (dateOfBirth) but works fine with @Past failure.
Here is my code:
package…

Ashutosh
- 4,371
- 10
- 59
- 105
1
vote
1 answer
restframework custom EXCEPTION_HANDLER not effect
In a new project custom exception_handler is working,but to my old project it's not working, i follow the doc custom exception handler
to writing. And I set print in my exception_handler, but it's not show any thing.(exception will be catch but…

ManHand
- 11
- 3
1
vote
0 answers
Is it possible to have multiple ExceptionHandler in ControllerAdvice for same Exception but different web requests?
I have a task to handle all exceptions in my project via @ControllerAdvice. The project has multiple controller methods. I have a custom exception which is thrown by some of these controller methods.
For handling this exception, I have a class…

Bhupesh_decoder
- 75
- 1
- 11
1
vote
0 answers
My custom ExceptionHandler does not work with Ajax requests
I don't know why, but my custom ExceptionHandler works great with normal requests, but not with errors in ajax requests.
This is the code of my ExceptionHandler:
public class YourExceptionHandler extends ExceptionHandlerWrapper {
private…

Marco Sulla
- 15,299
- 14
- 65
- 100
1
vote
3 answers
Ambiguous @ExceptionHandler method for HttpMessageNotReadableException
In my @RestController I'm successfully handling JSONParse exceptions coming from @RequestBody (for example, a String wrongly entered into an Integer field). This is the code:
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler({…

bz3x
- 171
- 4
- 15
1
vote
0 answers
In Spring boot TypeMismatchException.getPropertyName() is always returning null
In my Spring boot application, I have controller method with RequestParam Integer clockDrift. When testing it from Postman, if i provide integer value, everything is working as expected. But if I provide any string value in clockDrift field, the…

Thiagarajan Ramanathan
- 1,035
- 5
- 24
- 32
1
vote
0 answers
Why to use @ResponseBody with @ControllerAdvice in the case of RESTServices
I am learning about global exception handling in spring boot. I have a designed a controller annotated with @RestController which has a controller method that throws an exception. I have designed another class named GlobalExceptionHandling annotated…

raman bhadauria
- 145
- 2
- 11
1
vote
2 answers
Spring Boot - Pass Exception object from ResponseEntityExceptionHandler to HandlerInterceptor?
I am working on Spring Boot Example and implemented GlobalExceptionHandler and trying to print all error messages in JSON - it's my custom method.
Also, I have ExceptionHandler there I am catching all the Exception. But is there any way to pass the…

PAA
- 1
- 46
- 174
- 282
1
vote
1 answer
Why @ExceptionHandler annotated methods are protected?
Although not explicitly specified in @ExceptionHandler's official documentation, almost in all the examples on web, methods annotated with @ExceptionHandler are protected. Is there a specific reason for that?

canan
- 63
- 1
- 7
1
vote
1 answer
How to register JSF ExceptionHandlerFactory programmatically in Spring Boot
I'm using Joinfaces to build a JSF + Spring Boot application and Omnifaces is packed with it.
When the View expires and I navigate I get the ViewExpiredException. When I execute Ajax, the page does nothing and the error shows in the console.
Is it…

BBacon
- 2,456
- 5
- 32
- 52
1
vote
1 answer
WebApi v2 ExceptionHandler not working with HttpPost
How comes that a custom ExceptionHandler is never called and instead a standard response When Call HTTP Methods Post
This my code
WebApiConfig.cs
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
…

Toomy
- 11
- 3
1
vote
2 answers
How can I pass an array in throw new Exception() in PHP. What is the best possible away to pass an array in exception handler?
Here is my code but its send me error. Its said Wrong parameters for Exception handler.
try {
$validator = Validator::make($request->all(), [
'first_name' => 'required|max:255',
'last_name' => 'required|max:255',
…

Sahid Hossen
- 1,377
- 12
- 14
1
vote
1 answer
Android - Logging errors to an email account
I've implemented an ErrorHandler class into my app which is working just great but as I'm not sure if what I'm doing can fit into "best practices" just would like to share it with you to have your opinion.
My question is silly and my class is very…

Diego Perez
- 2,188
- 2
- 30
- 58
1
vote
1 answer
Questions about the size of the Springboot upload file
An error occurs when I upload the file size bigger than the set value. I want to
catch this exception and return it to the browser.The
e.getCause().getMessage() has a value , but not successfully return to
browser. Normally, a piece of json will…

yongguangl
- 87
- 2
- 11
1
vote
0 answers
How spring mvc handle responsebody and view excpetion?
I have a controller as
@Controller
@RequestMapping("/test")
public class TestController {
@RequestMapping("/1")
@ResponseBody
public String test1(){
Object o = null;
o.toString();
return "I ma test…

shuan
- 136
- 1
- 13