Published on

GraphQL, errors as data

Overview

  • Unpredicatable errors vs expected outcomes
  • Strongly-typed schema vs extensions array
  • Partial data and partial errors
    • a lot easier to manage
type Query {
  user(id: ID!): QueryUserResponse
}

type QueryUserResponse = User | BlockedUser | UserNotFound

type User {
  id: ID!
  email: String!
}

type BlockedUser {
  id: ID!
  reason: String!
}

type UserNotFound {
  id: ID!
  message: String!
}