Skip to content
This repository has been archived by the owner on Jun 2, 2021. It is now read-only.

API: in error JSON, return extensions extra info #12

Open
tttp opened this issue Mar 2, 2020 · 4 comments
Open

API: in error JSON, return extensions extra info #12

tttp opened this issue Mar 2, 2020 · 4 comments
Projects

Comments

@tttp
Copy link
Member

tttp commented Mar 2, 2020

Hi,

raised there fixthestatusquo/proca#11

Graphql has a standard error reporting (basically, clear text message), but as well the option to structure it better, eg adding our own error codes so the client can automatically process them

https://blog.atomist.com/error-handling-in-graphql/

So far, the errors I got are "programming" errors, like when I don't send mandatory fields, but we'll have more "user" errors, like signing duplicates or invalid emails or...

Another kind of related issue: some of the errors are potentially async (eg. a bounce email error), would it be crazy to open a websocket to allow to communicate back to the signatory? (it probably doesn't make sense for "only" handling email errors, but what about being able to offer update on the campaigns, like "someone you know just signed from twitter" "your share on whatsapp brought a new signature..."

@marcinkoziej
Copy link
Contributor

We will support error messages conforming to the spec,
so they can have a message that is mostly front-end developer directed, path which is filled by GraphQL runtime with mutation name for instance, and extensions map where we can put what we want, so for instance code and other keys

@tttp
Copy link
Member Author

tttp commented Mar 2, 2020

Is there a way to document (from within graphiql?) the codes that can be returned?

That'd be awesome ;)

@marcinkoziej
Copy link
Contributor

It can be documented in the description of the call, but we should create some document where we will write down what kind of error data we need ( for instance, code may not be enough, perhaps a map of fields->validation error code, or similar).

Error extensions is not part of the GraphQL schema (it's called extensions for a reason). It is not in any way enforced by the GraphQL runtime. It looks like the authors of GraphQL wanted to be agnostic about the shape of error object structure

@tttp
Copy link
Member Author

tttp commented Mar 2, 2020 via email

@marcinkoziej marcinkoziej added this to Backlog and questions in MVP Mar 2, 2020
@marcinkoziej marcinkoziej changed the title Should we handle better error messages? API: in error JSON, return extensions extra info Mar 2, 2020
@marcinkoziej marcinkoziej moved this from Backlog and questions to To do in MVP Mar 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
MVP
  
To do
Development

No branches or pull requests

2 participants