question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HttpResponseException getMessage() is always null

See original GitHub issue

Actual 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:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tipsycommented, Oct 3, 2018

Just had to pass the msg along. New version will be out sometime in the weekend 😃

0reactions
JosefEvAlloccommented, Oct 3, 2018

wow, that was fast. Thank you!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found