類別:MCPAuthBearerAuthError
當使用 Bearer 權杖進行驗證 (Authentication) 時發生問題時所拋出的錯誤。
繼承
建構子
建構子
new MCPAuthBearerAuthError(code: BearerAuthErrorCode, cause?: MCPAuthBearerAuthErrorDetails): MCPAuthBearerAuthError;
參數
code
cause?
回傳值
MCPAuthBearerAuthError
覆寫
屬性
cause?
readonly optional cause: MCPAuthBearerAuthErrorDetails;
繼承自
code
readonly code: BearerAuthErrorCode;
錯誤代碼,採用 snake_case 格式。
繼承自
message
message: string;
繼承自
name
name: string = 'MCPAuthBearerAuthError';
覆寫
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