• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Java exception.getMessage() wipes out the actual message from end and adds ... (557 bytes)

 
Ranch Hand
Posts: 658
2
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am hitting a REST api using Spring Boot RestTemplate. If the error response is smaller, exception.getMessage() returns the complete JSON structure of error, but if the error JSON gets 3 4 more lines added, it wiped out from the few keys and add ...(557 bytes) at the last.

Getting perfect JSON error response if error body is smaller:


But if a few more keys gets added to the error JSON, I get the below string on `exception.getMessage()`


The same API if I hit using Postman this is the complete error JSON:


How can I get the complete JSON out of exception message? And first of all, why is there a limit?
 
Marshal
Posts: 27536
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Puspender Tanwar wrote:And first of all, why is there a limit?



If there's a problem with, say, a 2-megabyte JSON, then putting the whole thing into the exception message verbatim would be considered annoyingly wasteful by a lot of users.
 
Puspender Tanwar
Ranch Hand
Posts: 658
2
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But how to get the actual error JSON then? I need to parse the JSON body.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
did you able to fix this issue. are you able to get whole error message
 
reply
    Bookmark Topic Watch Topic
  • New Topic