Questions tagged [exceptionhandler]

127 questions
2
votes
0 answers

need to get the actual request body content from WebRequest while overriding handleMethodArgumentNotValid method in ResponseEntityExceptionHandler

I want the request body content from WebRequest when I override the below method in my ExceptionHandler which extends ResponseEntityExceptionHandler. protected org.springframework.http.ResponseEntity
Somu
  • 51
  • 1
  • 5
2
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…
2
votes
2 answers

How to ignore an @ExceptionHandler from a dependency?

I'm having a problem trying to return a "ResponseEntity" in one of my methods which is located in a custom exception handler (annotated with @ExceptionHandler and @ControllerAdvice), I'm calling this method from a "doOnError" (rxjava), but my…
Marco Marchetti
  • 167
  • 1
  • 4
  • 13
2
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…
2
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
  • 373
  • 4
  • 20
2
votes
1 answer

More than one table found in namespace (, ) - with Spring, Hibernate and JPA

I’m using Spring 4 & Hibernate 5 with JPA and and Oracle Database, i have checked all my code and there is only one entity and a single table with the name LANGUE, My project still refuses to compile because of this error, Can someone help me please…
benito
  • 481
  • 5
  • 11
2
votes
1 answer

Change in Angular2 RC5 ExceptionHandler?

I'm migrating my Angular2 code to RC5 and can't figure out how to wire up my exception handling. In the RC4, it was part of the bootstrapping process in Main.ts: bootstrap(MyApp, [{provide: ExceptionHandler, useClass: GlobalExceptionHandler}]) But…
ibejo
  • 67
  • 1
  • 6
2
votes
0 answers

How to remove the background in Exception Handler gem in Rails 5?

I am trying to add this gem https://github.com/richpeck/exception_handler to my website. This is my config/application.rb config.exception_handler = { dev: true, db: false, #-> defaults to :errors if true, else use…
LovingRails
  • 1,529
  • 2
  • 14
  • 25
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,299
  • 5
  • 23
  • 38
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
  • 692
  • 8
  • 21
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…
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…
Pra_A
  • 7,134
  • 12
  • 89
  • 170
1
vote
1 answer

Override gem module in initializers

I have a specific gem gem installed and I wish to override the following method in the gem's module: def trace exception.backtrace.join("\n") end I need to change exception.backtrace.join("\n") to exception.backtrace.join("
") I don't want…
Ben
  • 1,825
  • 13
  • 22
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
  • 53
  • 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
  • 1,742
  • 3
  • 25
  • 46
1 2
3
8 9