Questions tagged [exceptionhandler]

186 questions
0
votes
0 answers

Prevent Spring Boot exception handler from re-formatting my JSON as string and escape quotation marks

I find that with Spring Boot 2.0.3, the JSON error message passed to the exception handler and returned to frontend will be formatted as a String instead of a JSON and escaped with \ before every double quotation mark(i.e., {"foo":"bar"} will be…
WesternGun
  • 11,303
  • 6
  • 88
  • 157
0
votes
1 answer

Add JSON message in RestCotroller

I want to add JSON message on REST controller class(methods). For example i have delete method look's like: @DeleteMapping("/people/{id}") public ResponseEntity deletePerson(@PathVariable Long id) { return personService …
0
votes
0 answers

Primefaces ExceptionHandler not working when view expired

My code is set up like https://www.primefaces.org/showcase/ui/misc/exceptionHandler.xhtml (only 1 button for ajax "throw view expired" implemented) and when I press that button, the dialog correctly pops up. p:ajaxExceptionHandler is registered for…
cpliu338
  • 645
  • 1
  • 7
  • 20
0
votes
1 answer

Exception Handler doesn't work in Spring Boot

I'm developing Rest API with Spring Boot 2 and I'm trying to create an ExceptionHandler but it seems it doesn't working. I have the following @GetMapping method: @GetMapping("/customers/{customerId}") public Customer getCustomerById(@PathVariable…
Dina Bogdan
  • 4,345
  • 5
  • 27
  • 56
0
votes
1 answer

How to get callStack in UnhandledExceptionFilter function winapi

How can I get the `callstack of the program context that lead to error (not the unhandled exception callstack) For example: LONG WINAPI myUnhandledException(PEXCEPTION_POINTERS pExceptionPtrs) { //Get the eip when the crash occur DWORD eip…
gedalia
  • 3
  • 3
0
votes
1 answer

Tomcat: ExceptionHasndler doesn't work for MultiPartException but works correct for IllegalArgumentException

I have controller like this: @PostMapping("/rest_upload1") public ResponseEntity upload1(@RequestParam("file") MultipartFile multipartFile) throws IOException { throw new IllegalArgumentException(); } and in configuration I have…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
0
votes
1 answer

Spring ControllerAdvice not being called on exceptions

Though I defined ControllerAdvice to handle exceptions, I dont see that being invoked. Here is my code, could you please advice public class RestError { private String code; private String message; public RestError(String…
venu88
  • 41
  • 4
0
votes
1 answer

python - suppress exception context in log output

I have the following test code: import logging def main(): l = ['a', 'b'] l.index('c') logging.basicConfig(level=logging.DEBUG, filename='myapp.log', format='') try: main() except: logging.exception('') When executed (in Python…
maurobio
  • 1,480
  • 4
  • 27
  • 38
0
votes
2 answers

Rails exception_handler gem not updating 404 page

I am using the exception_handler gem to make a custom 404 page. When I go to the 404 page on my site and it shows not found but how do I customize this page? I tried changing the routes, make errors_controller and not_found…
jrocc
  • 1,274
  • 2
  • 18
  • 48
0
votes
2 answers

Spring-boot @ExceptionHandler in Java8 is not reached out

I am using @ExcpetionHandler in my Java8 app. I'm unable to reach out to this function. Upon all exceptions, the HTTP response is always 500 (with the message I inserted into the exception), and it ignores the @ExceptionHandler methods. When my…
KerenSi
  • 389
  • 7
  • 20
0
votes
2 answers

How to use customexceptionhandlers in ASP.net web-api

I am trying to understand custom exceptionhandlers but am not getting the hang of it. I tried implementing a custom exception handler like explained in the following…
Tvt
  • 223
  • 1
  • 3
  • 16
0
votes
1 answer

How to throw and get the exception object in MoQ WebAPI

I have an OData enabled WebAPI that contains TestController: It contains a single custom action method. WebApiExceptionHandler: Custom exception handler in WebApi, registered in WebApiConfig.cs. ITestManager: Interface TestManager: Class…
Quest
  • 444
  • 1
  • 6
  • 18
0
votes
1 answer

$exceptionHandler decorator on strictdi - circular and strictdi errors

I'm having trouble with formatting my $exceptionHandler to strictdi. I'm trying to modify the exceptionhandler in order to log angular errors to our servers and let us know certain pages crash. For the code below, I am having circular dependency…
John
  • 13
  • 2
0
votes
2 answers

Failed to instantiate [org.springframework.web.servlet.HandlerExceptionResolver];Ambiguous @ExceptionHandler method mapped

My GlobalExceptionHandlerController class: @ControllerAdvice public class GlobalExceptionHandlerController { @ExceptionHandler @ResponseStatus(HttpStatus.NOT_FOUND) public String handleError404(HttpServletRequest request, Exception e)…
FuSsA
  • 4,223
  • 7
  • 39
  • 60
0
votes
1 answer

Accessing the error object inside of exceptionhandler method

Is there any way to get inside to the exception object when using annotation @ExceptionHandler? this is my code: @ExceptionHandler(DataInputException.class) public ResponseEntity handleException(){ return ResponseEntity …
filemonczyk
  • 1,613
  • 5
  • 26
  • 47