Function makeCaughtObjectReportJson

  • Wrapper for CorjMaker#makeReportObjectReportObject | CorjMaker.makeReportObject with default options specified in CORJ_MAKER_DEFAULT_OPTIONS.

    Parameters

    • caught: unknown
    • Optional options: {
          asJsonFormatsToApply?: [CorjAsJsonFormat, ...CorjAsJsonFormat[]];
          asStringFormatsToApply?: [CorjAsStringFormat, ...CorjAsStringFormat[]];
          childrenMetadataFields?: boolean | {
              $schema?: boolean;
              as_json_format?: boolean;
              as_string_format?: boolean;
              children_sources?: boolean;
              v?: boolean;
          };
          childrenSources?: string[];
          makeReportId?: ((context) => string);
          maxChildrenLevel?: number;
          metadataFields?: boolean | {
              $schema?: boolean;
              as_json_format?: boolean;
              as_string_format?: boolean;
              children_sources?: boolean;
              v?: boolean;
          };
          onCaughtMaking?: null | CorjMakerOnCaughtMakingCallbackFn;
          printWarningsOnUnhandledErrors?: boolean;
      }
      • Optional asJsonFormatsToApply?: [CorjAsJsonFormat, ...CorjAsJsonFormat[]]
      • Optional asStringFormatsToApply?: [CorjAsStringFormat, ...CorjAsStringFormat[]]
      • Optional childrenMetadataFields?: boolean | {
            $schema?: boolean;
            as_json_format?: boolean;
            as_string_format?: boolean;
            children_sources?: boolean;
            v?: boolean;
        }
      • Optional childrenSources?: string[]

        Fields to use as children.

      • Optional makeReportId?: ((context) => string)
          • (context): string
          • Parameters

            • context: {
                  caught: unknown;
                  index: number;
                  level: number;
                  path: string;
              }
              • caught: unknown
              • index: number
              • level: number
              • path: string

            Returns string

      • Optional maxChildrenLevel?: number

        Controls how much levels of nested errors will be included. For example

        • 1 means caught.cause is included, but caught.cause.cause is not.
        • 2 means caught.cause.cause is included, but caught.cause.cause.cause is not.
      • Optional metadataFields?: boolean | {
            $schema?: boolean;
            as_json_format?: boolean;
            as_string_format?: boolean;
            children_sources?: boolean;
            v?: boolean;
        }

        Controls adding metadata fields to report.

      • Optional onCaughtMaking?: null | CorjMakerOnCaughtMakingCallbackFn

        This function is called when CorjMaker.makeReportObject fails to produce along the way of producing a report.

      • Optional printWarningsOnUnhandledErrors?: boolean

        Print warning when onCaughtMaking is not set, or when onCaughtMaking itself threw an error.

    Returns CaughtObjectReportJson