Skip to main content

What Javascript/other tools would you use to convert a JSON response code (“400”) into an object? That is, if there’s no other content, but I want to “generate” content out of the status code.

Maybe try using try-catch to handle that error?

 

In the catch section of your code, you should be able to use the error message. 

 

Here's a link to try-catch:

https://www.w3schools.com/js/js_errors.asp


Hey @averycampbell, hope you’re well, I just wanted to check in here!

Were you able to get things going with the information from Jhealyn, or can we still help here?

I believe the Try-Catch recommendation would be a solid place to start for catching errors. The main difference from the example is that you want to return a JSON object vs generating HTML into an HTML p tag.