UnsupportedEnvironmentError class

Extends

Proprietà ereditate

correlationId
error
errorCodes
errorDescription
message
name
stack
stackTraceLimit

La Error.stackTraceLimit proprietà specifica il numero di frame di stack raccolti da una traccia di stack (che sia generata da new Error().stack o Error.captureStackTrace(obj)).

Il valore predefinito è 10 ma può essere impostato a qualsiasi numero JavaScript valido. Le modifiche influenzeranno qualsiasi traccia dello stack catturata dopo che il valore è stato modificato.

Se impostato a un valore non numerico, o a un numero negativo, le traccia dello stack non cattureranno alcun fotogramma.

subError

Metodi ereditati

captureStackTrace(object, Function)

Crea una .stack proprietà su targetObject, che quando accedita restituisce una stringa che rappresenta la posizione nel codice a cui Error.captureStackTrace() è stato chiamato.

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

La prima riga della traccia sarà preceduta da ${myObject.name}: ${myObject.message}.

L'argomento opzionale constructorOpt accetta una funzione. Se dato, tutti i frame sopra constructorOpt, incluso constructorOpt, verranno omessi dalla traccia dello stack generata.

L'argomento constructorOpt è utile per nascondere i dettagli dell'implementazione della generazione degli errori all'utente. Per esempio:

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[])

Fare riferimento a https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Dettagli costruttore

UnsupportedEnvironmentError(string)

new UnsupportedEnvironmentError(correlationId?: string)

Parametri

correlationId

string

Dettagli proprietà ereditate

correlationId

correlationId?: string

Valore della proprietà

string

Ereditato daCustomAuthError.correlationId

error

error: string

Valore della proprietà

string

Ereditato daCustomAuthError.error

errorCodes

errorCodes?: number[]

Valore della proprietà

number[]

Ereditato daCustomAuthError.errorCodes

errorDescription

errorDescription?: string

Valore della proprietà

string

Ereditato daCustomAuthError.errorDescription

message

message: string

Valore della proprietà

string

Ereditato daCustomAuthError.message

name

name: string

Valore della proprietà

string

Ereditato daCustomAuthError.name

stack

stack?: string

Valore della proprietà

string

Ereditato daCustomAuthError.stack

stackTraceLimit

La Error.stackTraceLimit proprietà specifica il numero di frame di stack raccolti da una traccia di stack (che sia generata da new Error().stack o Error.captureStackTrace(obj)).

Il valore predefinito è 10 ma può essere impostato a qualsiasi numero JavaScript valido. Le modifiche influenzeranno qualsiasi traccia dello stack catturata dopo che il valore è stato modificato.

Se impostato a un valore non numerico, o a un numero negativo, le traccia dello stack non cattureranno alcun fotogramma.

static stackTraceLimit: number

Valore della proprietà

number

Ereditato daCustomAuthError.stackTraceLimit

subError

subError?: string

Valore della proprietà

string

Ereditato daCustomAuthError.subError

Dettagli dei metodi ereditati

captureStackTrace(object, Function)

Crea una .stack proprietà su targetObject, che quando accedita restituisce una stringa che rappresenta la posizione nel codice a cui Error.captureStackTrace() è stato chiamato.

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

La prima riga della traccia sarà preceduta da ${myObject.name}: ${myObject.message}.

L'argomento opzionale constructorOpt accetta una funzione. Se dato, tutti i frame sopra constructorOpt, incluso constructorOpt, verranno omessi dalla traccia dello stack generata.

L'argomento constructorOpt è utile per nascondere i dettagli dell'implementazione della generazione degli errori all'utente. Per esempio:

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)

Parametri

targetObject

object

constructorOpt

Function

Ereditato daCustomAuthError.captureStackTrace

prepareStackTrace(Error, CallSite[])

Fare riferimento a https://v8.dev/docs/stack-trace-api#customizing-stack-traces

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

Parametri

err

Error

stackTraces

CallSite[]

Valori restituiti

any

Ereditato daCustomAuthError.prepareStackTrace