Class: MCPAuthError
Base class for all mcp-auth errors.
It provides a standardized way to handle errors related to MCP authentication and authorization.
Extends
Error
Extended by
Constructors
Constructor
new MCPAuthError(code: string, message: string): MCPAuthError;
Parameters
code
string
The error code in snake_case format.
message
string
A human-readable description of the error.
Returns
MCPAuthError
Overrides
Error.constructor
Properties
cause?
optional cause: unknown;
Inherited from
Error.cause
code
readonly code: string;
The error code in snake_case format.
message
message: string;
Inherited from
Error.message
name
name: string = 'MCPAuthError';
Overrides
Error.name
stack?
optional stack: string;
Inherited from
Error.stack
prepareStackTrace()?
static optional prepareStackTrace: (err: Error, stackTraces: CallSite[]) => any;
Optional override for formatting stack traces
Parameters
err
Error
stackTraces
CallSite
[]
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTrace
stackTraceLimit
static stackTraceLimit: number;
Inherited from
Error.stackTraceLimit
Methods
toJson()
toJson(showCause: boolean): Record<string, unknown>;
Converts the error to a HTTP response friendly JSON format.
Parameters
showCause
boolean
= false
Whether to include the cause of the error in the JSON response.
Defaults to false
.
Returns
Record
<string
, unknown
>
captureStackTrace()
static captureStackTrace(targetObject: object, constructorOpt?: Function): void;
Create .stack property on a target object
Parameters
targetObject
object
constructorOpt?
Function
Returns
void
Inherited from
Error.captureStackTrace