CustomAuthError class

Extends

Error

Propiedades heredadas

message
name
stack
stackTraceLimit

La Error.stackTraceLimit propiedad especifica el número de marcos de pila recogidos por una traza de pila (ya sea generada por new Error().stack o Error.captureStackTrace(obj)).

El valor por defecto es 10 pero puede estar establecido en cualquier número JavaScript válido. Los cambios afectarán a cualquier traza de pila capturada después de que el valor haya sido modificado.

Si se asigna a un valor distinto de un número, o a un número negativo, las pistas de pila no capturarán ningún fotograma.

Métodos heredados

captureStackTrace(object, Function)

Crea una .stack propiedad en targetObject, que al ser accedida devuelve una cadena que representa la ubicación en el código en la que Error.captureStackTrace() se llamó.

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

La primera línea de la traza tendrá el prefijo de ${myObject.name}: ${myObject.message}.

El argumento opcional constructorOpt acepta una función. Si se da, todos los fotogramas por encima constructorOptde , incluyendo constructorOpt, se omitirán de la traza de pila generada.

El constructorOpt argumento es útil para ocultar al usuario detalles de la generación de errores de la implementación. Por ejemplo:

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();
prepareStackTrace(Error, CallSite[])

Vea https://v8.dev/docs/stack-trace-api#customizing-stack-traces.

Detalles del constructor

CustomAuthError(string, string, string, number[], string)

new CustomAuthError(error: string, errorDescription?: string, correlationId?: string, errorCodes?: number[], subError?: string)

Parámetros

error

string

errorDescription

string

correlationId

string

errorCodes

number[]

subError

string

Detalles de las propiedades

correlationId

correlationId?: string

Valor de propiedad

string

error

error: string

Valor de propiedad

string

errorCodes

errorCodes?: number[]

Valor de propiedad

number[]

errorDescription

errorDescription?: string

Valor de propiedad

string

subError

subError?: string

Valor de propiedad

string

Detalles de las propiedades heredadas

message

message: string

Valor de propiedad

string

Heredado de Error.message

name

name: string

Valor de propiedad

string

heredado de Error.name

stack

stack?: string

Valor de propiedad

string

heredado de Error.stack

stackTraceLimit

La Error.stackTraceLimit propiedad especifica el número de marcos de pila recogidos por una traza de pila (ya sea generada por new Error().stack o Error.captureStackTrace(obj)).

El valor por defecto es 10 pero puede estar establecido en cualquier número JavaScript válido. Los cambios afectarán a cualquier traza de pila capturada después de que el valor haya sido modificado.

Si se asigna a un valor distinto de un número, o a un número negativo, las pistas de pila no capturarán ningún fotograma.

static stackTraceLimit: number

Valor de propiedad

number

Heredado de Error.stackTraceLimit

Detalles de los métodos heredados

captureStackTrace(object, Function)

Crea una .stack propiedad en targetObject, que al ser accedida devuelve una cadena que representa la ubicación en el código en la que Error.captureStackTrace() se llamó.

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

La primera línea de la traza tendrá el prefijo de ${myObject.name}: ${myObject.message}.

El argumento opcional constructorOpt acepta una función. Si se da, todos los fotogramas por encima constructorOptde , incluyendo constructorOpt, se omitirán de la traza de pila generada.

El constructorOpt argumento es útil para ocultar al usuario detalles de la generación de errores de la implementación. Por ejemplo:

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();
static function captureStackTrace(targetObject: object, constructorOpt?: Function)

Parámetros

targetObject

object

constructorOpt

Function

Heredado de Error.captureStackTrace

prepareStackTrace(Error, CallSite[])

Vea https://v8.dev/docs/stack-trace-api#customizing-stack-traces.

static function prepareStackTrace(err: Error, stackTraces: CallSite[]): any

Parámetros

err

Error

stackTraces

CallSite[]

Devoluciones

any

Heredado de Error.prepareStackTrace