-
-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Error types #140
Comments
You can do However looking at the Circe encoder i think this will get transformed into a string anyway so I might have to make that more flexible. I’ll have a look when I get back. |
Now I have at least two points where I have to transform my domain errors into
def flatMap[A](f: T => Either[ExecutionError, A]): ArgBuilder[A] = (input: InputValue) => self.build(input).flatMap(f)
So I have to convert my domain errors into JSON and put them into So, we need to figure out how to handle this problem... |
For 2. they don’t have to be |
I created a PR #145 which should correctly encode the message into an object instead of a string per the spec. More work will need to be done to provide the other fields. In particular the
The second point would actually have further use when creating middleware such as the apollo-tracing or apollo-caching spec both of which require paths in order to build the extension body. The last requirement of having a custom extension body would be easier to service. We could add a |
Just an update to this: new custom error types are supported without being throwable via; #1059 |
Now
CalibanError
is a sealed trait and all of the messages will be decoded as a string like:But as the GraphQL Spec says, the recommended error looks like:
And my domain error trait looks like:
No matter what, I hope that Caliban can handle the JSONObject type, rather than put everything into a single string.
The text was updated successfully, but these errors were encountered: