CustomAuthError class

Extends

Error

Devralınan Özellikler

message
name
stack
stackTraceLimit

Bu özellik, Error.stackTraceLimit bir yığın izi tarafından toplanan yığın çerçeve sayısını (ister tarafından new Error().stack oluşturulmuş olsun) Error.captureStackTrace(obj)belirtir.

Varsayılan değer 10 ise herhangi bir geçerli JavaScript numarasına ayarlanabilir. Değişiklikler, değer değiştirildikten sonra yakalanan tüm yığın izlerini etkiler.

Eğer sayı olmayan bir değere veya negatif bir saya ayarlanırsa, stack izleri hiçbir kare yakalamaz.

Devralınan Yöntemler

captureStackTrace(object, Function)

Üzerinde .stackbir targetObject özellik oluşturur ve erişildiğinde, çağrılan koddaki Error.captureStackTrace() konumu temsil eden bir diziyi döndürür.

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

İzin ilk satırına ön ekler eklenecek ${myObject.name}: ${myObject.message}.

Isteğe bağlı constructorOpt argüman bir fonksiyonu kabul eder. Verildiyse, , constructorOptdahil, üzerindeki constructorOpttüm kareler üretilen yığın izinden çıkarılacaktır.

Bu argüman constructorOpt , hata oluşturma uygulama detaylarını kullanıcıdan gizlemek için faydalıdır. Örneğin:

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

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

Oluşturucu Ayrıntıları

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

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

Parametreler

error

string

errorDescription

string

correlationId

string

errorCodes

number[]

subError

string

Özellik Ayrıntıları

correlationId

correlationId?: string

Özellik Değeri

string

error

error: string

Özellik Değeri

string

errorCodes

errorCodes?: number[]

Özellik Değeri

number[]

errorDescription

errorDescription?: string

Özellik Değeri

string

subError

subError?: string

Özellik Değeri

string

Devralınan Özellik Detayları

message

message: string

Özellik Değeri

string

Hatasından Devralınmış Error.message

name

name: string

Özellik Değeri

string

Error.name'dan Devralınan

stack

stack?: string

Özellik Değeri

string

Error.stack'ten Devralınmış

stackTraceLimit

Bu özellik, Error.stackTraceLimit bir yığın izi tarafından toplanan yığın çerçeve sayısını (ister tarafından new Error().stack oluşturulmuş olsun) Error.captureStackTrace(obj)belirtir.

Varsayılan değer 10 ise herhangi bir geçerli JavaScript numarasına ayarlanabilir. Değişiklikler, değer değiştirildikten sonra yakalanan tüm yığın izlerini etkiler.

Eğer sayı olmayan bir değere veya negatif bir saya ayarlanırsa, stack izleri hiçbir kare yakalamaz.

static stackTraceLimit: number

Özellik Değeri

number

Devralınan Error.stackTraceLimit

Devralınan Yöntemin Ayrıntıları

captureStackTrace(object, Function)

Üzerinde .stackbir targetObject özellik oluşturur ve erişildiğinde, çağrılan koddaki Error.captureStackTrace() konumu temsil eden bir diziyi döndürür.

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

İzin ilk satırına ön ekler eklenecek ${myObject.name}: ${myObject.message}.

Isteğe bağlı constructorOpt argüman bir fonksiyonu kabul eder. Verildiyse, , constructorOptdahil, üzerindeki constructorOpttüm kareler üretilen yığın izinden çıkarılacaktır.

Bu argüman constructorOpt , hata oluşturma uygulama detaylarını kullanıcıdan gizlemek için faydalıdır. Örneğin:

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)

Parametreler

targetObject

object

constructorOpt

Function

Devralınan Error.captureStackTrace

prepareStackTrace(Error, CallSite[])

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

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

Parametreler

err

Error

stackTraces

CallSite[]

Döndürülenler

any

Devralınan Error.prepareStackTrace