Questions tagged [exceptionhandler]
186 questions
5
votes
2 answers
why linux set the data-segment to __USER_DS at the prologue of exception handler
I'm trying to read Linux source code(2.6.11)
In the exception handler, at entry.s,
error_code:
movl $(__USER_DS), %ecx
movl %ecx, %ds
movl %ecx, %es
I don't know why loading user data segment here. Since it is supposed to be entering the exception…

Holmes
- 63
- 4
4
votes
0 answers
How to catch all the exceptions in Spring boot 2 webflux with @ControllerAdvice
My application is made by Spring Boot 2 webflux and thymeleaf, I want to catch all the exception and render the error to a customized error page.
I use @ControllerAdvice and @ExceptionHandler to catch exceptions and handle errors in a central…

user2592010
- 41
- 1
- 3
4
votes
1 answer
Unable to catch JsonMappingException in Exception Handler
I have a rest api written in Java (spring boot), my request takes a json string from request header(do not ask why this way:), e.g. {flowerId: 123}
In my controller, I map the string to object.
So when users pass in junk data, e.g. {flowerId:…

toosensitive
- 2,335
- 7
- 46
- 88
4
votes
2 answers
Spring boot @RequestBody with @Valid- ExceptionHandler for MethodArgumentNotValidException
I want to use @Valid annotation with @RequestBody annotation and handle error inside my own method annotated with @ExceptionHandler annotation. I want always return instance of ReponseEntity. But when i'm creating ExceptionHandler for…

Patryk kowalski
- 313
- 2
- 5
- 18
4
votes
1 answer
Lost stack trace when exception is handelled with @ControllerAdvice annotated class
I have a spring REST application. I throw all the exceptions from controller and handle them at a common place, a class named ExceptionHandlerControllerAdvice annotated with @ControllerAdvice. There I have multiple methods annotated with…

Arjit
- 421
- 7
- 20
4
votes
0 answers
Spring MVC 4.1 - How to catch all exceptions without breaking Spring Security
I'm using Spring MVC 4.1 and Spring Security 3.2. I wanted to handle gracefully all exceptions that can happen during HTTP calls (including AJAX calls) on the backend without breaking Spring Security. What solutions would you recommend?
Initially I…

Kacper86
- 448
- 1
- 8
- 16
4
votes
1 answer
No @ResponseBody returned from @ExceptionHandler in Spring boot app deployed in Tomcat
I have a Spring Boot web app that runs just fine from STS but shows different behavior when running in Tomcat from a WAR file.
I use Thymeleaf to handle all my web pages but I have a couple pages that are using jQuery to send async calls and make…

Damien Polegato
- 508
- 4
- 13
3
votes
1 answer
Java Test for Spring ExceptionalHandler
I have a springboot project with controllers and servies. And a GlobalExceptionHandler like -
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
@ExceptionHandler(DataIntegrityViolationException.class)
public…

Akanksha
- 181
- 3
- 8
3
votes
1 answer
Initializing DefaultHttpContext.Response.Body to MemoryStream throws NullReferencePointer
I am working on implementation of global exception middleware and I would like to cover middleware with unit tests. Below you see how far I got.
This is a code of unit test.
[Fact]
public async Task…

Daniel Rusnok
- 449
- 1
- 7
- 14
3
votes
0 answers
finally block handling when using @ControllerAdvice and @ExceptionHandler
Situation
I'm having a controller class with try catch exception handling within the controller class. Lately I have been trying to move the traditional try catch block to spring's @ControllerAdvice and @ExceptionHandler.
However my controller is…

Abhilash Nazar
- 31
- 2
3
votes
1 answer
Spring HttpMessageConverter according to @ExceptionHandler response content type
I have a Rest web service based on Spring MVC. I use a @RestControllerAdvice to handle exceptions thrown from my @Controllers.
Controller
An example of call is as below
@GetMapping(value = "/{id}/{name:.+}", produces = {…

Radouane ROUFID
- 10,595
- 9
- 42
- 80
3
votes
1 answer
Rails exception_handler gem
I've installed Rails exception_handler and tried following the instructions to setup custom error handling, however I'm still getting the standard 500 error message that the gem creates:
500 Internal Server Error
If you are the administrator of…

Godzilla74
- 2,358
- 1
- 31
- 67
3
votes
1 answer
Angular JS : $exceptionHandler without try or throw block?
app.factory('$exceptionHandler', function() {
return function(exception, cause) {
exception.message += ' (caused by "' + cause + '")';
throw exception;
};
});
Is it possible to handle all the exception globally in…

shreyansh
- 1,637
- 4
- 26
- 46
3
votes
1 answer
How Runtime Exceptions are handled by Spring ExceptionHandler
I am using spring's @ControllerAdvice and @ExceptionHandler for exception handling.
Any method throws custom exception from Controller and corresponding @ExceptionHandler handle it. If Runtime exception occurs(eg any HibernateException) then it…

Suraj
- 1,625
- 1
- 15
- 33
3
votes
1 answer
Exception Handler for Laravel 5 Packages
I want to write a separate exception handler for one Laravel5 package, such that it displays the custom 404 view of that package.
Actually I want to know how should I register the Exception Handler of a package inside the provider of that…

Alenoosh Baghumian
- 115
- 9