🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@apollo-link-debug/handle-errors

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

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.

0.0.5
latest
Source
npm
Version published
Weekly downloads
63
34.04%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 14 Jun 2023

Did you know?

Socket

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