marksparkza/jschon

Provide Error Code along with error messages in output format

Closed this issue · 3 comments

As a library user, it would be helpful if jschon can provide numeric error codes( and name if possible) in addition to the error messages in output format since we may have to translate the same in other languages.

  1. Current error node can point to error code instead of the message.
  2. title and description annotations can be used to add more details of the error.

Prior art:

  1. HTTP Error Codes
  2. Typescript Error Codes
  3. Postgres Error Codes

I'm inclined to concur with Greg Dennis's view in the linked issue - that the keyword itself (which can be inferred from keywordLocation) can effectively be taken to be the error code.

I do agree though that error messaging in jschon needs work, in terms of allowing customization and localization. I'll create a separate issue for this.

PS: The suggestions by Greg Dennis will only be reflected in the next version of JSON Schema.