跳轉到主要內容

類別:MCPAuthConfigError

當 mcp-auth 配置出現問題時所拋出的錯誤。

繼承自

建構子

建構子

new MCPAuthConfigError(code: string, message: string): MCPAuthConfigError;

參數

code

string

以 snake_case 格式表示的錯誤代碼。

message

string

易於理解的錯誤描述。

回傳值

MCPAuthConfigError

繼承自

MCPAuthError.constructor

屬性

cause?

optional cause: unknown;

繼承自

MCPAuthError.cause


code

readonly code: string;

以 snake_case 格式表示的錯誤代碼。

繼承自

MCPAuthError.code


message

message: string;

繼承自

MCPAuthError.message


name

name: string = 'MCPAuthConfigError';

覆寫自

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