類別:MCPAuthAuthServerError
當遠端授權 (Authorization) 伺服器發生問題時所拋出的錯誤。
繼承自
建構子
建構子
new MCPAuthAuthServerError(code: AuthServerErrorCode, cause?: unknown): MCPAuthAuthServerError;
參數
code
cause?
unknown
回傳值
MCPAuthAuthServerError
覆寫自
屬性
cause?
readonly optional cause: unknown;
繼承自
code
readonly code: AuthServerErrorCode;
錯誤代碼,採用 snake_case 格式。
繼承自
message
message: string;
繼承自
name
name: string = 'MCPAuthAuthServerError';
覆寫自
stack?
optional stack: string;
繼承自
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;
繼承自
方法
toJson()
toJson(showCause: boolean): Record<string, unknown>;
將錯誤轉換為適合 HTTP 回應的 JSON 格式。
參數
showCause
boolean
= false
是否在 JSON 回應中包含錯誤原因。
預設為 false
。
回傳值
Record
<string
, unknown
>
繼承自
captureStackTrace()
static captureStackTrace(targetObject: object, constructorOpt?: Function): void;
在目標物件上建立 .stack 屬性
參數
targetObject
object
constructorOpt?
Function
回傳值
void