Dennis Kreminsky
Dennis Kreminsky

Reputation: 2089

JSON and Exceptions

Does anyone know of a neat way to encode arbitrary server-side exceptions into JSON without introducing any JSON schema? I'm talking about arbitrary JSON that comes from the server, with some part of it possibly containing usable information about exceptions that fired on the server.

Upvotes: 0

Views: 72

Answers (1)

trojanfoe
trojanfoe

Reputation: 122381

Unless the protocol has some sort of mechanism to describe errors (if it's HTTP then it does - it has an HTTP Response code with associated text) then you cannot provide new information without changing the schema; if it needs to be encoded within the JSON payload then you will have create new 'schema' for the exception messages.

Upvotes: 1

Related Questions