in reply to Re: EyeBall stumps BodBall
in thread EyeBall stumps BodBall (Error Handling)

This reminds me of GraphQL, which is heavily orientated towards usage in web APIs, specifically JSON. See https://graphql.org/ for more, and https://graphql.org/swapi-graphql/?query=%7B%0A%20%20allFilms%20%7B%0A%20%20%20%20films%20%7B%0A%20%20%20%20%20%20title%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D for the Star Wars GraphQL API with a sample query (there's autocomplete in that).

The return values in that are canonically (in JavaScript terms) objects, i.e. in Perl terms hash-refs, which have at least one of data and/or errors. It does exception-catching to turn those into errors entries.

I mention this because it is "guaranteed" (with the usual caveats) to return JSON. I would suggest your web service should adopt a similar philosophy, so that 500s aren't possible, and an appropriate return to the user always happens.