Oh gotcha! Look into union types. Unions allow you to return this or that and are often used with Error types.
Your example would probably look like this in the schema:
union LoginResult = User | CustomError login(...): LoginResult
The docs describe unions in more detail: graphql.org/learn/schema/#union-types And Sasha Solomon has written about how she's used this pattern at Medium and Twitter: medium.com/@sachee/200-ok-error-ha...
Hey Eve, sorry for not replying. I got this working using your initial idea - returning a custom type :)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Oh gotcha! Look into union types. Unions allow you to return this or that and are often used with Error types.
Your example would probably look like this in the schema:
The docs describe unions in more detail: graphql.org/learn/schema/#union-types
And Sasha Solomon has written about how she's used this pattern at Medium and Twitter: medium.com/@sachee/200-ok-error-ha...
Hey Eve, sorry for not replying. I got this working using your initial idea - returning a custom type :)