An open API service indexing awesome lists of open source software.

https://github.com/codaline-io/create-apollo-error

smart helper to create errors for apollo server >=v4
https://github.com/codaline-io/create-apollo-error

Last synced: over 1 year ago
JSON representation

smart helper to create errors for apollo server >=v4

Awesome Lists containing this project

README

          

# create-apollo-error
smart helper to create errors for apollo server >=v4

## Usage

```TS
import { createApolloError } from '@codaline-io/create-apollo-error'

throw createApolloError(message, optionalErrorCode, optionalErrorType, optionalGraphQLErrorOptions)
```

- optionalErrorCode?: string | null -> graphqlError.extensions.code
- optionalErrorType?: string | null -> graphqlError.extensions.type
- optionalGraphQLErrorOptions?: GraphQLErrorOptions, e.g. setting original error and so on