HttpResponseException getMessage() is always null
See original GitHub issueActual behavior (the bug)
When catching an exception, e.g.:
try {
result = ctx.validatedBodyAsClass(MyClass.class).getOrThrow();
} catch (BadRequestResponse ex) {
System.out.println(ex.getMsg()); // contains actual exception message
System.out.println(ex.getMessage()); // is null
}
Expected behavior
System.out.println(ex.getMessage());
Should not be null, but contain the actual message (Java interface contract for Exceptions)
To Reproduce See code above
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Exception.getMessage() is null - java - Stack Overflow
An example I've encountered is where e.getMessage() returns "-1", but e.toString() returns "ArrayIndexOutOfBoundsException: -1". Which would you ...
Read more >Solved: Exception getMessage() returns null - Experts Exchange
The method getMessage() is derived from Throwable class itself. This message is null if the exception object is created with no error message....
Read more >HttpResponseException where's the error message ? - MSDN
In my nUnit tests , I need to verify that the thrown exception contains the expected text -- my 'text' arg to CreateErrorResponse()...
Read more >HttpResponseException (google-http-client 1.42.2) - javadoc.io
Returns the HTTP status message or null for none. boolean, isSuccessStatusCode(). Returns whether received a successful HTTP status code >= 200 && <...
Read more >getting null using exception.getMessage() - Oracle Communities
hi i am getting null using exception.getMessage() in JSP. I am no able to figure out where i am making mistake. i am...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just had to pass the
msg
along. New version will be out sometime in the weekend 😃wow, that was fast. Thank you!