index.d.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { GraphQLError, GraphQLFormattedError } from 'graphql';
  2. export declare class ApolloError extends Error implements GraphQLError {
  3. extensions: Record<string, any>;
  4. readonly name: any;
  5. readonly locations: any;
  6. readonly path: any;
  7. readonly source: any;
  8. readonly positions: any;
  9. readonly nodes: any;
  10. originalError: any;
  11. [key: string]: any;
  12. constructor(message: string, code?: string, extensions?: Record<string, any>);
  13. }
  14. export declare function toApolloError(error: Error & {
  15. extensions?: Record<string, any>;
  16. }, code?: string): Error & {
  17. extensions: Record<string, any>;
  18. };
  19. export interface ErrorOptions {
  20. code?: string;
  21. errorClass?: new (message: string) => ApolloError;
  22. }
  23. export declare function fromGraphQLError(error: GraphQLError, options?: ErrorOptions): ApolloError;
  24. export declare class SyntaxError extends ApolloError {
  25. constructor(message: string);
  26. }
  27. export declare class ValidationError extends ApolloError {
  28. constructor(message: string);
  29. }
  30. export declare class AuthenticationError extends ApolloError {
  31. constructor(message: string);
  32. }
  33. export declare class ForbiddenError extends ApolloError {
  34. constructor(message: string);
  35. }
  36. export declare class PersistedQueryNotFoundError extends ApolloError {
  37. constructor();
  38. }
  39. export declare class PersistedQueryNotSupportedError extends ApolloError {
  40. constructor();
  41. }
  42. export declare class UserInputError extends ApolloError {
  43. constructor(message: string, properties?: Record<string, any>);
  44. }
  45. export declare function formatApolloErrors(errors: ReadonlyArray<Error>, options?: {
  46. formatter?: (error: GraphQLError) => GraphQLFormattedError;
  47. debug?: boolean;
  48. }): Array<ApolloError>;
  49. export declare function hasPersistedQueryError(errors: Array<Error>): boolean;
  50. //# sourceMappingURL=index.d.ts.map