Skip to main content

Errors

For usage patterns, see Usage - Tracing and Usage - Agents.

MentioraError

Base exception for all Mentiora SDK errors. All specific error classes extend this.

class MentioraError extends Error {
readonly code: string;
constructor(message: string, code: string);
}

You can catch MentioraError to handle any SDK error, or use the code property for programmatic error handling.

ConfigurationError

Thrown when the client configuration is invalid.

class ConfigurationError extends MentioraError {
// code: 'CONFIGURATION_ERROR'
constructor(message: string);
}

ValidationError

Thrown when trace event data is invalid.

class ValidationError extends MentioraError {
// code: 'VALIDATION_ERROR'
constructor(message: string);
}

NetworkError

Thrown when a network or HTTP error occurs. On 4xx/5xx responses, the SDK parses the server's JSON error body and exposes serverCode and serverMessage for programmatic error handling.

class NetworkError extends MentioraError {
// code: 'NETWORK_ERROR'
readonly statusCode?: number;
readonly serverCode?: string; // e.g. 'agent_not_found', 'invalid_request'
readonly serverMessage?: string; // Detailed error message from the server
constructor(
message: string,
statusCode?: number,
serverCode?: string,
serverMessage?: string,
);
}

See also: Client | Tracing | Agents