Make result type generic on ApolloOperationErrorHandlerFunction
This commit is contained in:
@@ -2,16 +2,17 @@ import { processApolloError } from './processApolloError';
|
||||
import { ApolloOperationContext } from '../types';
|
||||
import { Vue } from 'vue/types/vue';
|
||||
import { ApolloError, ApolloOperationErrorHandlerFunction } from './types';
|
||||
import { ApolloErrorHandlerResult, ApolloErrorHandlerResultInterface } from './ApolloErrorHandlerResult';
|
||||
import { ApolloErrorHandlerResult } from './ApolloErrorHandlerResult';
|
||||
|
||||
/**
|
||||
* This is a simple example of an error handler function. You can copy this and implement your own in your application.
|
||||
*/
|
||||
export const handleApolloError: ApolloOperationErrorHandlerFunction<ApolloError, Vue> = (
|
||||
error: ApolloError,
|
||||
app: Vue,
|
||||
context?: ApolloOperationContext,
|
||||
): ApolloErrorHandlerResultInterface => {
|
||||
export const handleApolloError: ApolloOperationErrorHandlerFunction<
|
||||
ApolloError,
|
||||
Vue,
|
||||
ApolloOperationContext,
|
||||
ApolloErrorHandlerResult
|
||||
> = (error: ApolloError, app: Vue, context?: ApolloOperationContext): ApolloErrorHandlerResult => {
|
||||
const { unhandledErrors, handledErrors } = processApolloError(error, {
|
||||
app,
|
||||
context,
|
||||
|
||||
+2
-1
@@ -83,4 +83,5 @@ export type ApolloOperationErrorHandlerFunction<
|
||||
TError = BaseApolloError,
|
||||
TApp extends Vue = Vue,
|
||||
TContext = ApolloOperationContext,
|
||||
> = (error: TError, app: TApp, context?: TContext) => ApolloErrorHandlerResultInterface;
|
||||
TResult = ApolloErrorHandlerResultInterface,
|
||||
> = (error: TError, app: TApp, context?: TContext) => TResult;
|
||||
|
||||
Reference in New Issue
Block a user