Questions tagged [exceptionhandler]
186 questions
2
votes
1 answer
ResponseEntityExceptionHandler does not send an error code to the client despite @ResponseStatus annotation
I want to prevent spring from sending complete stacktrace of Runtimexceptions to the front end. I did something like this:
@ControllerAdvice
public class RestErrorHandler extends ResponseEntityExceptionHandler {
…

Anmol Gupta
- 2,797
- 9
- 27
- 43
2
votes
0 answers
Is there a way to listen all exceptions?
My purpose is creating a Java library which listens and store all errors. I have caught every uncaught exception via Thread#UncaughtExceptionHandler,
but when Java code has try and catch block inside the code and is not throwing exception…

Munees Majid
- 747
- 2
- 8
- 22
1
vote
0 answers
How to write an exception handler in Linux kernel module
I am writing a Linux driver, which will interact with user programs. This driver will receive some parameters from user code. However, some exceptions may occur in the kernel module. For example, there is an invalid pointer in these parameters, and…

Kayroger
- 11
- 2
1
vote
0 answers
ResponseStatusException exception handler not triggered?
I'm trying to add an exception handler for ResponseStatusException in my Spring 3 project.
@ControllerAdvice
public class ErrorHandler extends ResponseEntityExceptionHandler {
@Autowired
private ObjectMapper objectMapper;
…

Reid2
- 41
- 4
1
vote
0 answers
Catching an Exception and Throwing a New, Empty one
I have an application which is failing some process without much information getting logged. I'm looking at the code in question - which produces the error string I see logged - and I see the following structure:
public void MyFunction(MyObj…

Luke
- 2,434
- 9
- 39
- 64
1
vote
1 answer
Crashpad not generating a crash report after qml is executed
I'm trying to integrate Crashpad with Qt, with some QML in my code.
Here the crash report is generated successfully without any issue.
CrashpadClient *client = initializeCrashpad();
if (!client) {
std::cout << "Crash not processed";
}
…

Jatin Rastogi
- 11
- 3
1
vote
1 answer
How to remove or hide default property from json output which using default library of asp.net
I've got code on fist screenshot first screenshot, needed to display only this four properties. But when i start using this code i get my 4 properties + 2 unnecessary. Second screenshot(result):second screenshot
I tried to this one, but its not…

XedDevil
- 15
- 3
1
vote
0 answers
How to send HttpStatus reasonPhrase/StatusDescription in addition to status code with ResponseEntity in Spring Rest
I am using below ControllerAdvice to return error response. But vendor who are writing client code are complaining that they don't get reasonPhrase/StatusDescription with this. They are expecting 'Bad Request'. They using vb.net. Told them it will…

Sammy Pawar
- 1,201
- 3
- 19
- 38
1
vote
0 answers
Can I call a ControllerAdvice when rendering a view from an ExceptionHandler in another ControllerAdvice?
I have a ControllerAdvice that renders the requestUri to the model, since the thymeleaf upgrade (3.10) removed the #httpServletRequest attribute.
@ControllerAdvice
class UtilityProvider {
@ModelAttribute("requestUri")
fun…

peach
- 657
- 5
- 26
1
vote
0 answers
Unable to Handle Exception with @ErrorHandler Annotation
I'm new to Spring Boot. I'm trying to handle a exception when a value is null. Basically, its a value that I'm suppose to get from another external service (using restTemplate.exchange() method) which is currently down, so a null value gets assigned…

Vansh
- 29
- 1
1
vote
1 answer
How to log execution time with ExceptionHandler
I am trying to refactor my application and now i also want to use an ExceptionHandler.
Therefore I already implemented some Methods like
@org.springframework.web.bind.annotation.ExceptionHandler(Exception.class)
public final…

Marco Florio
- 13
- 3
1
vote
2 answers
AssertJ exception handling (feat.assertThat+isInstanceOf)
I have been on this problem for hours but couldn't get close to solution.
Any help will be appreciated.
public static int enterTheAmount(){
int final LOTTO_PRICE = 1000;
int amount = Integer.parseInt(Console.readLine());
…

Dan Lee
- 13
- 2
1
vote
0 answers
org.apache.catalina.connector.ClientAbortException: java.io.IOException: Key no longer registered
It is giving us this error right after updating and uploading the app changes. It stays that way, until we restart Tomcat.
We know what the error means. The connection between the client and the server has been closed. But it only happens when we…

daniel_ip
- 11
- 1
1
vote
1 answer
@ControllerAdvice or @ExceptionHandler both not working on gradle project
I have written a very simple gradle spring boot project. But non of my exception handling is working.
Tried handling at @Controller level and also at global via @ControllerAdvice, but both doesn't seems to work.
Could it be because its a gradle…

Akash Tyagi
- 97
- 2
- 15
1
vote
0 answers
how to set @ControllerAdvice or @ExceptionHandler encoding to UTF-8?
I use Spring MVC, Tomcat 8.5.81 and java-configured context. Here is the controller class. If I send ResponseEntity> with Cyrillic from here, everything is represented on the client correctly.
@RestController
@RequestMapping(value = "/rooms",…

cognosce
- 11
- 4