GraphqlSubscriptionError
Error of a GraphQL subscription, reported to the
socket.onError
callbacks and to the
onEnd
of its listeners.
The server ended the subscription with the
error
message - its validation or its source failed.
errors
holds what
it sent.
Errors of a single event do not end the subscription and come with the event in
extra.errors
.
Import
import { GraphqlSubscriptionError } from "@hyper-fetch/graphql"
Source
Package
Parameters
class GraphqlSubscriptionError {
constructor(__namedParameters: GraphqlSubscriptionErrorOptionsType) {};
topic: string;
payload: unknown;
errors: GraphQLFormattedError[];
}
Parameters
| Name | Type | Description |
|---|---|---|
| __namedParameters | |
Usage
socket.onError(({ error }) => {
if (error instanceof GraphqlSubscriptionError && error.errors[0].extensions?.code === "UNAUTHENTICATED") {
logout();
}
});
