跳轉到主要內容

類別:MCPAuthAuthServerError

當遠端授權伺服器發生問題時所拋出的錯誤。

繼承自​

建構子​

建構子​

new MCPAuthAuthServerError(code: AuthServerErrorCode, cause?: unknown): MCPAuthAuthServerError;

參數​

code​

AuthServerErrorCode

cause?​

unknown

回傳​

MCPAuthAuthServerError

覆寫自​

MCPAuthError.constructor

屬性​

cause?​

readonly optional cause: unknown;

繼承自​

MCPAuthError.cause


code​

readonly code: AuthServerErrorCode;

錯誤代碼,採用 snake_case 格式。

繼承自​

MCPAuthError.code


message​

message: string;

繼承自​

MCPAuthError.message


name​

name: string = 'MCPAuthAuthServerError';

覆寫自​

MCPAuthError.name


stack?​

optional stack: string;

繼承自​

MCPAuthError.stack


prepareStackTrace()?​

static optional prepareStackTrace: (err: Error, stackTraces: CallSite[]) => any;

可選的堆疊追蹤格式化覆寫方法

參數​

err​

Error

stackTraces​

CallSite[]

回傳​

any

參考​

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

繼承自​

MCPAuthError.prepareStackTrace


stackTraceLimit​

static stackTraceLimit: number;

繼承自​

MCPAuthError.stackTraceLimit

方法​

toJson()​

toJson(showCause: boolean): Record<string, unknown>;

將錯誤轉換為適合 HTTP 回應的 JSON 格式。

參數​

showCause​

boolean = false

是否在 JSON 回應中包含錯誤原因。 預設為 false。

回傳​

Record<string, unknown>

繼承自​

MCPAuthError.toJson


captureStackTrace()​

static captureStackTrace(targetObject: object, constructorOpt?: Function): void;

在目標物件上建立 .stack 屬性

參數​

targetObject​

object

constructorOpt?​

Function

回傳​

void

繼承自​

MCPAuthError.captureStackTrace