UNPKG

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.

48 lines (47 loc) 1.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UserAlreadyExistsError = exports.UserNotFoundError = exports.UserError = void 0; const base_1 = require("./base"); /** * Base class for user-related exceptions. * * This exception is raised for errors related to user management * in the RecallrAI API. */ class UserError extends base_1.RecallrAIError { constructor(message = 'User error occurred', code = 'user_error', httpStatus, details) { super(message, code, httpStatus, details); Object.setPrototypeOf(this, UserError.prototype); } } exports.UserError = UserError; /** * Raised when a user is not found. * * This exception is typically raised when trying to access or modify * a user that doesn't exist. */ class UserNotFoundError extends UserError { constructor(userId, message, code = 'user_not_found', httpStatus = 404, details) { const errorMessage = message || `User${userId ? ` ${userId}` : ''} not found`; super(errorMessage, code, httpStatus, details); Object.setPrototypeOf(this, UserNotFoundError.prototype); this.userId = userId; } } exports.UserNotFoundError = UserNotFoundError; /** * Raised when a user already exists. * * This exception is typically raised when trying to create a user * that already exists in the system. */ class UserAlreadyExistsError extends UserError { constructor(userId, message, code = 'user_already_exists', httpStatus = 409, details) { const errorMessage = message || `User${userId ? ` ${userId}` : ''} already exists`; super(errorMessage, code, httpStatus, details); Object.setPrototypeOf(this, UserAlreadyExistsError.prototype); this.userId = userId; } } exports.UserAlreadyExistsError = UserAlreadyExistsError;