Member Junction
    Preparing search index...

    Hierarchy

    • GraphQLError
      • AuthorizationError
    Index

    Constructors

    • Parameters

      • Optionalmessage: string

      Returns AuthorizationError

    Properties

    cause?: unknown
    coordinate?: string

    An optional schema coordinate (e.g. "MyType.myField") associated with this error.

    extensions: { code: "UNAUTHORIZED"; [attributeName: string]: unknown }

    Extension fields to add to the formatted error.

    locations: readonly SourceLocation[]

    An array of { line, column } locations within the source GraphQL document which correspond to this error.

    Errors during validation often contain multiple locations, for example to point out two things with the same name. Errors during execution include a single location, the field which produced the error.

    Enumerable, and appears in the result of JSON.stringify().

    message: string
    name: string
    nodes: readonly ASTNode[]

    An array of GraphQL AST Nodes corresponding to this error.

    originalError: Error

    The original error thrown from a field resolver during execution.

    path: readonly (string | number)[]

    An array describing the JSON-path into the execution response which corresponds to this error. Only included for errors during execution.

    Enumerable, and appears in the result of JSON.stringify().

    positions: readonly number[]

    An array of character offsets within the source GraphQL document which correspond to this error.

    source: Source

    The source GraphQL document for the first location of this error.

    Note that if this Error represents more than one node, the source may not represent nodes after the first node.

    stack?: string
    stackTraceLimit: number

    The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

    The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

    If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

    Accessors

    • get "[toStringTag]"(): string

      Returns string

    Methods

    • Returns GraphQLFormattedError

    • Returns a string representation of an object.

      Returns string

    • Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

      const myObject = {};
      Error.captureStackTrace(myObject);
      myObject.stack; // Similar to `new Error().stack`

      The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

      The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

      The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

      function a() {
      b();
      }

      function b() {
      c();
      }

      function c() {
      // Create an error without stack trace to avoid calculating the stack trace twice.
      const { stackTraceLimit } = Error;
      Error.stackTraceLimit = 0;
      const error = new Error();
      Error.stackTraceLimit = stackTraceLimit;

      // Capture the stack trace above function b
      Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
      throw error;
      }

      a();

      Parameters

      • targetObject: object
      • OptionalconstructorOpt: Function

      Returns void