Coda by Ian Macalinao
    Preparing search index...

    Class CodamaError<TErrorCode>

    Type Parameters

    Hierarchy

    • Error
      • CodamaError
    Index

    Constructors

    • Type Parameters

      Parameters

      • ...__namedParameters: CodamaErrorContext[TErrorCode] extends undefined
            ? [code: TErrorCode, errorOptions?: ErrorOptions]
            : [
                code: TErrorCode,
                contextAndErrorOptions: CodamaErrorContext[TErrorCode] & (
                    ErrorOptions
                    | undefined
                ),
            ]

      Returns CodamaError<TErrorCode>

    Properties

    cause?: unknown
    context: Readonly<
        {
            "1": { kind: string } & { __code: 1 };
            "10": { field: CamelCaseString } & { __code: 10 };
            "11": { field: CamelCaseString } & { __code: 11 };
            "1200000": {
                duplicatedPdaNames: CamelCaseString[];
                program: ProgramNode;
                programName: CamelCaseString;
            } & { __code: 1200000 };
            "1200001": {
                instruction: InstructionNode;
                instructionName: CamelCaseString;
                pda: PdaNode;
                pdaName: CamelCaseString;
            } & { __code: 1200001 };
            "1200002": {
                cycle: (
                    | InstructionAccountNode<InstructionInputValueNode | undefined>
                    | InstructionArgumentNode<InstructionInputValueNode | undefined>
                )[];
                formattedCycle: string;
                instruction: InstructionNode;
                instructionName: CamelCaseString;
            } & { __code: 1200002 };
            "1200003": {
                instruction: InstructionNode;
                instructionAccount: InstructionAccountNode;
                instructionAccountName: CamelCaseString;
                instructionName: CamelCaseString;
                seed: PdaSeedValueNode<AccountValueNode>;
                seedName: CamelCaseString;
                seedValueName: CamelCaseString;
            } & { __code: 1200003 };
            "1200004": {
                dependency:
                    | InstructionAccountNode<InstructionInputValueNode | undefined>
                    | InstructionArgumentNode<InstructionInputValueNode | undefined>;
                dependencyKind: "instructionAccountNode" | "instructionArgumentNode";
                dependencyName: CamelCaseString;
                instruction: InstructionNode;
                instructionName: CamelCaseString;
                parent:
                    | InstructionAccountNode<InstructionInputValueNode | undefined>
                    | InstructionArgumentNode<InstructionInputValueNode | undefined>;
                parentKind: "instructionAccountNode" | "instructionArgumentNode";
                parentName: CamelCaseString;
            } & { __code: 1200004 };
            "1200005": {
                account: AccountNode;
                missingField: CamelCaseString;
                name: CamelCaseString;
            } & { __code: 1200005 };
            "1200006": { wrapper: string } & { __code: 1200006 };
            "1200007": { visitFunction: string } & { __code: 1200007 };
            "1200008": {
                formattedHistogram: string;
                validationItems: ValidationItem[];
            } & { __code: 1200008 };
            "1200009": {
                argumentName: CamelCaseString;
                instruction: InstructionNode;
                instructionName: CamelCaseString;
            } & { __code: 1200009 };
            "1200010": { conflictingAttributes: CamelCaseString[] } & {
                __code: 1200010;
            };
            "1200011": { key: string } & { __code: 1200011 };
            "1200012": { path: readonly Node[] } & { __code: 1200012 };
            "2": {
                expectedKinds: (
                    | "accountNode"
                    | "definedTypeNode"
                    | "errorNode"
                    | "instructionAccountNode"
                    | "instructionArgumentNode"
                    | "instructionByteDeltaNode"
                    | "instructionNode"
                    | "instructionRemainingAccountsNode"
                    | "pdaNode"
                    | "programNode"
                    | "pdaSeedValueNode"
                    | "accountBumpValueNode"
                    | "accountValueNode"
                    | "argumentValueNode"
                    | "conditionalValueNode"
                    | "identityValueNode"
                    | "payerValueNode"
                    | "pdaValueNode"
                    | "programIdValueNode"
                    | "resolverValueNode"
                    | "fixedCountNode"
                    | "prefixedCountNode"
                    | "remainderCountNode"
                    | "constantDiscriminatorNode"
                    | "fieldDiscriminatorNode"
                    | "sizeDiscriminatorNode"
                    | "accountLinkNode"
                    | "definedTypeLinkNode"
                    | "instructionAccountLinkNode"
                    | "instructionArgumentLinkNode"
                    | "instructionLinkNode"
                    | "pdaLinkNode"
                    | "programLinkNode"
                    | "constantPdaSeedNode"
                    | "variablePdaSeedNode"
                    | "enumEmptyVariantTypeNode"
                    | "enumStructVariantTypeNode"
                    | "enumTupleVariantTypeNode"
                    | "amountTypeNode"
                    | "arrayTypeNode"
                    | "booleanTypeNode"
                    | "bytesTypeNode"
                    | "dateTimeTypeNode"
                    | "enumTypeNode"
                    | "fixedSizeTypeNode"
                    | "hiddenPrefixTypeNode"
                    | "hiddenSuffixTypeNode"
                    | "mapTypeNode"
                    | "numberTypeNode"
                    | "optionTypeNode"
                    | "postOffsetTypeNode"
                    | "preOffsetTypeNode"
                    | "publicKeyTypeNode"
                    | "remainderOptionTypeNode"
                    | "sentinelTypeNode"
                    | "setTypeNode"
                    | "sizePrefixTypeNode"
                    | "solAmountTypeNode"
                    | "stringTypeNode"
                    | "structTypeNode"
                    | "tupleTypeNode"
                    | "zeroableOptionTypeNode"
                    | "structFieldTypeNode"
                    | "mapEntryValueNode"
                    | "arrayValueNode"
                    | "booleanValueNode"
                    | "bytesValueNode"
                    | "constantValueNode"
                    | "enumValueNode"
                    | "mapValueNode"
                    | "noneValueNode"
                    | "numberValueNode"
                    | "publicKeyValueNode"
                    | "setValueNode"
                    | "someValueNode"
                    | "stringValueNode"
                    | "structValueNode"
                    | "tupleValueNode"
                    | "structFieldValueNode"
                    | "rootNode"
                )[];
                kind: | "accountNode"
                | "definedTypeNode"
                | "errorNode"
                | "instructionAccountNode"
                | "instructionArgumentNode"
                | "instructionByteDeltaNode"
                | "instructionNode"
                | "instructionRemainingAccountsNode"
                | "pdaNode"
                | "programNode"
                | "pdaSeedValueNode"
                | "accountBumpValueNode"
                | "accountValueNode"
                | "argumentValueNode"
                | "conditionalValueNode"
                | "identityValueNode"
                | "payerValueNode"
                | "pdaValueNode"
                | "programIdValueNode"
                | "resolverValueNode"
                | "fixedCountNode"
                | "prefixedCountNode"
                | "remainderCountNode"
                | "constantDiscriminatorNode"
                | "fieldDiscriminatorNode"
                | "sizeDiscriminatorNode"
                | "accountLinkNode"
                | "definedTypeLinkNode"
                | "instructionAccountLinkNode"
                | "instructionArgumentLinkNode"
                | "instructionLinkNode"
                | "pdaLinkNode"
                | "programLinkNode"
                | "constantPdaSeedNode"
                | "variablePdaSeedNode"
                | "enumEmptyVariantTypeNode"
                | "enumStructVariantTypeNode"
                | "enumTupleVariantTypeNode"
                | "amountTypeNode"
                | "arrayTypeNode"
                | "booleanTypeNode"
                | "bytesTypeNode"
                | "dateTimeTypeNode"
                | "enumTypeNode"
                | "fixedSizeTypeNode"
                | "hiddenPrefixTypeNode"
                | "hiddenSuffixTypeNode"
                | "mapTypeNode"
                | "numberTypeNode"
                | "optionTypeNode"
                | "postOffsetTypeNode"
                | "preOffsetTypeNode"
                | "publicKeyTypeNode"
                | "remainderOptionTypeNode"
                | "sentinelTypeNode"
                | "setTypeNode"
                | "sizePrefixTypeNode"
                | "solAmountTypeNode"
                | "stringTypeNode"
                | "structTypeNode"
                | "tupleTypeNode"
                | "zeroableOptionTypeNode"
                | "structFieldTypeNode"
                | "mapEntryValueNode"
                | "arrayValueNode"
                | "booleanValueNode"
                | "bytesValueNode"
                | "constantValueNode"
                | "enumValueNode"
                | "mapValueNode"
                | "noneValueNode"
                | "numberValueNode"
                | "publicKeyValueNode"
                | "setValueNode"
                | "someValueNode"
                | "stringValueNode"
                | "structValueNode"
                | "tupleValueNode"
                | "structFieldValueNode"
                | "rootNode"
                | null;
                node: Node
                | null
                | undefined;
            } & { __code: 2 };
            "2100000": { idlType: string } & { __code: 2100000 };
            "2100001": { name: string } & { __code: 2100001 };
            "2100002": { name: string } & { __code: 2100002 };
            "2100003": { idlType: string; path: string } & { __code: 2100003 };
            "2100004": { kind: string } & { __code: 2100004 };
            "2100005": { kind: string } & { __code: 2100005 };
            "2800000": {
                kind:
                    | "accountNode"
                    | "definedTypeNode"
                    | "errorNode"
                    | "instructionAccountNode"
                    | "instructionArgumentNode"
                    | "instructionByteDeltaNode"
                    | "instructionNode"
                    | "instructionRemainingAccountsNode"
                    | "pdaNode"
                    | "programNode"
                    | "pdaSeedValueNode"
                    | "accountBumpValueNode"
                    | "accountValueNode"
                    | "argumentValueNode"
                    | "conditionalValueNode"
                    | "identityValueNode"
                    | "payerValueNode"
                    | "pdaValueNode"
                    | "programIdValueNode"
                    | "resolverValueNode"
                    | "fixedCountNode"
                    | "prefixedCountNode"
                    | "remainderCountNode"
                    | "constantDiscriminatorNode"
                    | "fieldDiscriminatorNode"
                    | "sizeDiscriminatorNode"
                    | "accountLinkNode"
                    | "definedTypeLinkNode"
                    | "instructionAccountLinkNode"
                    | "instructionArgumentLinkNode"
                    | "instructionLinkNode"
                    | "pdaLinkNode"
                    | "programLinkNode"
                    | "constantPdaSeedNode"
                    | "variablePdaSeedNode"
                    | "enumEmptyVariantTypeNode"
                    | "enumStructVariantTypeNode"
                    | "enumTupleVariantTypeNode"
                    | "amountTypeNode"
                    | "arrayTypeNode"
                    | "booleanTypeNode"
                    | "bytesTypeNode"
                    | "dateTimeTypeNode"
                    | "enumTypeNode"
                    | "fixedSizeTypeNode"
                    | "hiddenPrefixTypeNode"
                    | "hiddenSuffixTypeNode"
                    | "mapTypeNode"
                    | "numberTypeNode"
                    | "optionTypeNode"
                    | "postOffsetTypeNode"
                    | "preOffsetTypeNode"
                    | "publicKeyTypeNode"
                    | "remainderOptionTypeNode"
                    | "sentinelTypeNode"
                    | "setTypeNode"
                    | "sizePrefixTypeNode"
                    | "solAmountTypeNode"
                    | "stringTypeNode"
                    | "structTypeNode"
                    | "tupleTypeNode"
                    | "zeroableOptionTypeNode"
                    | "structFieldTypeNode"
                    | "mapEntryValueNode"
                    | "arrayValueNode"
                    | "booleanValueNode"
                    | "bytesValueNode"
                    | "constantValueNode"
                    | "enumValueNode"
                    | "mapValueNode"
                    | "noneValueNode"
                    | "numberValueNode"
                    | "publicKeyValueNode"
                    | "setValueNode"
                    | "someValueNode"
                    | "stringValueNode"
                    | "structValueNode"
                    | "tupleValueNode"
                    | "structFieldValueNode"
                    | "rootNode";
                node: Node
                | undefined;
            } & { __code: 2800000 };
            "3": {
                expectedKinds: (
                    | "accountNode"
                    | "definedTypeNode"
                    | "errorNode"
                    | "instructionAccountNode"
                    | "instructionArgumentNode"
                    | "instructionByteDeltaNode"
                    | "instructionNode"
                    | "instructionRemainingAccountsNode"
                    | "pdaNode"
                    | "programNode"
                    | "pdaSeedValueNode"
                    | "accountBumpValueNode"
                    | "accountValueNode"
                    | "argumentValueNode"
                    | "conditionalValueNode"
                    | "identityValueNode"
                    | "payerValueNode"
                    | "pdaValueNode"
                    | "programIdValueNode"
                    | "resolverValueNode"
                    | "fixedCountNode"
                    | "prefixedCountNode"
                    | "remainderCountNode"
                    | "constantDiscriminatorNode"
                    | "fieldDiscriminatorNode"
                    | "sizeDiscriminatorNode"
                    | "accountLinkNode"
                    | "definedTypeLinkNode"
                    | "instructionAccountLinkNode"
                    | "instructionArgumentLinkNode"
                    | "instructionLinkNode"
                    | "pdaLinkNode"
                    | "programLinkNode"
                    | "constantPdaSeedNode"
                    | "variablePdaSeedNode"
                    | "enumEmptyVariantTypeNode"
                    | "enumStructVariantTypeNode"
                    | "enumTupleVariantTypeNode"
                    | "amountTypeNode"
                    | "arrayTypeNode"
                    | "booleanTypeNode"
                    | "bytesTypeNode"
                    | "dateTimeTypeNode"
                    | "enumTypeNode"
                    | "fixedSizeTypeNode"
                    | "hiddenPrefixTypeNode"
                    | "hiddenSuffixTypeNode"
                    | "mapTypeNode"
                    | "numberTypeNode"
                    | "optionTypeNode"
                    | "postOffsetTypeNode"
                    | "preOffsetTypeNode"
                    | "publicKeyTypeNode"
                    | "remainderOptionTypeNode"
                    | "sentinelTypeNode"
                    | "setTypeNode"
                    | "sizePrefixTypeNode"
                    | "solAmountTypeNode"
                    | "stringTypeNode"
                    | "structTypeNode"
                    | "tupleTypeNode"
                    | "zeroableOptionTypeNode"
                    | "structFieldTypeNode"
                    | "mapEntryValueNode"
                    | "arrayValueNode"
                    | "booleanValueNode"
                    | "bytesValueNode"
                    | "constantValueNode"
                    | "enumValueNode"
                    | "mapValueNode"
                    | "noneValueNode"
                    | "numberValueNode"
                    | "publicKeyValueNode"
                    | "setValueNode"
                    | "someValueNode"
                    | "stringValueNode"
                    | "structValueNode"
                    | "tupleValueNode"
                    | "structFieldValueNode"
                    | "rootNode"
                )[];
                kind: | "accountNode"
                | "definedTypeNode"
                | "errorNode"
                | "instructionAccountNode"
                | "instructionArgumentNode"
                | "instructionByteDeltaNode"
                | "instructionNode"
                | "instructionRemainingAccountsNode"
                | "pdaNode"
                | "programNode"
                | "pdaSeedValueNode"
                | "accountBumpValueNode"
                | "accountValueNode"
                | "argumentValueNode"
                | "conditionalValueNode"
                | "identityValueNode"
                | "payerValueNode"
                | "pdaValueNode"
                | "programIdValueNode"
                | "resolverValueNode"
                | "fixedCountNode"
                | "prefixedCountNode"
                | "remainderCountNode"
                | "constantDiscriminatorNode"
                | "fieldDiscriminatorNode"
                | "sizeDiscriminatorNode"
                | "accountLinkNode"
                | "definedTypeLinkNode"
                | "instructionAccountLinkNode"
                | "instructionArgumentLinkNode"
                | "instructionLinkNode"
                | "pdaLinkNode"
                | "programLinkNode"
                | "constantPdaSeedNode"
                | "variablePdaSeedNode"
                | "enumEmptyVariantTypeNode"
                | "enumStructVariantTypeNode"
                | "enumTupleVariantTypeNode"
                | "amountTypeNode"
                | "arrayTypeNode"
                | "booleanTypeNode"
                | "bytesTypeNode"
                | "dateTimeTypeNode"
                | "enumTypeNode"
                | "fixedSizeTypeNode"
                | "hiddenPrefixTypeNode"
                | "hiddenSuffixTypeNode"
                | "mapTypeNode"
                | "numberTypeNode"
                | "optionTypeNode"
                | "postOffsetTypeNode"
                | "preOffsetTypeNode"
                | "publicKeyTypeNode"
                | "remainderOptionTypeNode"
                | "sentinelTypeNode"
                | "setTypeNode"
                | "sizePrefixTypeNode"
                | "solAmountTypeNode"
                | "stringTypeNode"
                | "structTypeNode"
                | "tupleTypeNode"
                | "zeroableOptionTypeNode"
                | "structFieldTypeNode"
                | "mapEntryValueNode"
                | "arrayValueNode"
                | "booleanValueNode"
                | "bytesValueNode"
                | "constantValueNode"
                | "enumValueNode"
                | "mapValueNode"
                | "noneValueNode"
                | "numberValueNode"
                | "publicKeyValueNode"
                | "setValueNode"
                | "someValueNode"
                | "stringValueNode"
                | "structValueNode"
                | "tupleValueNode"
                | "structFieldValueNode"
                | "rootNode"
                | null;
                node: Node
                | null
                | undefined;
            } & { __code: 3 };
            "4": {
                kind:
                    | "accountLinkNode"
                    | "definedTypeLinkNode"
                    | "instructionAccountLinkNode"
                    | "instructionArgumentLinkNode"
                    | "instructionLinkNode"
                    | "pdaLinkNode"
                    | "programLinkNode";
                linkNode: RegisteredLinkNode;
                name: CamelCaseString;
                path: readonly Node[];
            } & { __code: 4 };
            "5": { fsFunction: string } & { __code: 5 };
            "6": { codamaVersion: string; rootVersion: string } & { __code: 6 };
            "7": { format: string } & { __code: 7 };
            "8": { encoding: string } & { __code: 8 };
            "9": {
                enum: EnumTypeNode;
                enumName: CamelCaseString;
                variant: CamelCaseString;
            } & { __code: 9 };
        },
    >[TErrorCode]
    message: string
    name: string
    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.

    Methods

    • 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