ExceptionHelper class
Helper class for generating exceptions with error codes.
Properties
| DEFAULT_HELPLINK | Default help link template for error codes. The {errorCode} token will be replaced with the actual error code. |
Methods
| generate |
Generates a typed exception with error code and help link. The message format is: [CODE] - [message] - [helplink] |
Property Details
DEFAULT_HELPLINK
Default help link template for error codes. The {errorCode} token will be replaced with the actual error code.
static DEFAULT_HELPLINK: "https://aka.ms/M365AgentsErrorCodesJS/#{errorCode}" = "https://aka.ms/M365AgentsErrorCodesJS/#{errorCode}"
Property Value
"https://aka.ms/M365AgentsErrorCodesJS/#{errorCode}"
Method Details
generateException<T>((message: string, innerException?: Error) => T, AgentErrorDefinition, Error, {[key: string]: string})
Generates a typed exception with error code and help link. The message format is: [CODE] - [message] - [helplink]
static function generateException<T>(ErrorType: (message: string, innerException?: Error) => T, errorDefinition: AgentErrorDefinition, innerException?: Error, params?: {[key: string]: string}): T & AgentError
Parameters
- ErrorType
-
(message: string, innerException?: Error) => T
The constructor of the error type to create
- errorDefinition
- AgentErrorDefinition
The error definition containing code, description, and optional help link
- innerException
-
Error
Optional inner exception
- params
-
{[key: string]: string}
Optional parameters object for message formatting with key-value pairs
Returns
T & AgentError
A new exception instance with error code and help link, typed as AgentError