w3c-ccg / vc-api

A specification for an HTTP API used to issue and verify Verifiable Credentials.
https://w3c-ccg.github.io/vc-api
Other
120 stars 46 forks source link

Should the API define error codes? #395

Open msporny opened 1 month ago

msporny commented 1 month ago

The API has the capability of returning ProblemDetail errors today but does not define error codes itself (many of the codes come from the VCDM or status list specifications). It was suggested that the API should define and throw some error codes that are specific to the API such as "UNKNOWN_OPTION_PROVIDED" when an unknown option is provided to an API call.

dlongley commented 1 month ago

We might want to limit the number of error codes to higher level categories, similar to what is seen here:

https://developer.mozilla.org/en-US/docs/Web/API/DOMException#error_names

So that we don't have a new error code for every possible, individual error.

PatStLouis commented 1 month ago

I think we should be mindful of what we can define that would make testing these features convenient (test software will need something to assert a response on when providing a bad input) while also not making the specification too rigid. This aligns with the comment made by @dlongley.