recallrai
Version:
Official Node.js SDK for RecallrAI - Revolutionary contextual memory system that enables AI assistants to form meaningful connections between conversations, just like human memory.
46 lines (45 loc) • 1.82 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SessionNotFoundError = exports.InvalidSessionStateError = exports.SessionError = void 0;
const base_1 = require("./base");
/**
* Base class for session-related exceptions.
*
* This exception is raised for errors related to session management
* in the RecallrAI API.
*/
class SessionError extends base_1.RecallrAIError {
constructor(message = 'Session error occurred', code = 'session_error', httpStatus, details) {
super(message, code, httpStatus, details);
Object.setPrototypeOf(this, SessionError.prototype);
}
}
exports.SessionError = SessionError;
/**
* Raised when a session is in an invalid state.
*
* This exception is typically raised when trying to perform an action
* on a session that is not in the expected state.
*/
class InvalidSessionStateError extends SessionError {
constructor(message = 'Invalid session state', code = 'invalid_session_state', httpStatus = 400, details) {
super(message, code, httpStatus, details);
Object.setPrototypeOf(this, InvalidSessionStateError.prototype);
}
}
exports.InvalidSessionStateError = InvalidSessionStateError;
/**
* Raised when a session is not found.
*
* This exception is typically raised when trying to access or modify
* a session that doesn't exist.
*/
class SessionNotFoundError extends SessionError {
constructor(sessionId, message, code = 'session_not_found', httpStatus = 404, details) {
const errorMessage = message || `Session${sessionId ? ` ${sessionId}` : ''} not found`;
super(errorMessage, code, httpStatus, details);
Object.setPrototypeOf(this, SessionNotFoundError.prototype);
this.sessionId = sessionId;
}
}
exports.SessionNotFoundError = SessionNotFoundError;