Socket
Socket
Sign inDemoInstall

@apollo-link-debug/handle-errors

Package Overview
Dependencies
37
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @apollo-link-debug/handle-errors

Debugs errors returned in a GraphQL response via apollo to the console.


Version published
Weekly downloads
40
increased by344.44%
Maintainers
1
Install size
5.54 kB
Created
Weekly downloads
 

Readme

Source

Debugs errors returned in a GraphQL response via apollo to the console.

Installation

npm i @apollo-link-debug/handle-errors
# - or -
yarn add @apollo-link-debug/handle-errors

Usage

import { ApolloClient, ApolloLink, InMemoryCache } from '@apollo/client';
import { createErrorsLink } from '@apollo-link-debug/handle-errors';

const client = new ApolloClient({
  uri: 'https://localhost:3000/',
  cache: new InMemoryCache(),
  link: ApolloLink.from([createErrorsLink()]),
});

Example output:

MyOperationName GraphQL error
  on line: 1, column: 6

Options

onGraphQLErrors: ({ operation, errors, message }) => void

A callback which occurs when an error is returned from the GraphQL request. The errors object is an array of errors returned from the server, and the message is a string with a human-readable intepretation of the error.

onNetworkError: ({ operation, error }) => void

A callback which occurs when there is an error outside of the GraphQL sphere. For example, the server may not be contactable.

FAQs

Last updated on 14 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc