Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.

Latest commit

 

History

History
41 lines (32 loc) · 937 Bytes

errors-implement-usererror.md

File metadata and controls

41 lines (32 loc) · 937 Bytes

Errors should implement UserError

A type should implement the UserError interface if and only if its name ends with Error.

Rule Details

Examples of correct code for this rule:

type BaseUserError implements UserError {
  message: String!
  code: ErrorCode!
}
type PasswordTooWeakError implements UserError {
  message: String!
  code: ErrorCode!
  passwordRules: [String!]!
}

Examples of incorrect code for this rule:

type NotAnErrorType implements UserError {
  message: String!
  code: ErrorCode!
  otherStuff: String!
}
type PasswordTooWeakError {
  passwordRules: [String!]!
}

When Not To Use It

Do not use this for developer errors. Then again, you should probably revisit the GraphQL style guide if you're adding developer error graphql types.