• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

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

 
Ranch Hand
Posts: 656
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: 26597
81
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: 656
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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic