UNPKG

@litert/redis

Version:

A redis protocol implement for Node.js.

97 lines 3.44 kB
"use strict"; /** * Copyright 2025 Angus.Fenying <fenying@litert.org> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.E_NOT_MULTI_MODE = exports.E_INVALID_PARAM = exports.E_CONNECT_TIMEOUT = exports.E_COMMAND_TIMEOUT = exports.E_COMMAND_QUEUE_FULL = exports.E_CONNECT_FAILED = exports.E_CONN_LOST = exports.E_COMMAND_FAILURE = exports.E_PROTOCOL_ERROR = exports.RedisError = void 0; /** * The error class for RedisClient. */ class RedisError extends Error { origin; constructor( /** * The name of the error. */ name, /** * The message of the error. */ message, /** * The metadata of the error. */ origin = null) { super(message); this.origin = origin; this.name = name; } } exports.RedisError = RedisError; const E_PROTOCOL_ERROR = class extends RedisError { constructor(origin = null) { super('protocol_error', 'Malformed data received from remote server.', origin); } }; exports.E_PROTOCOL_ERROR = E_PROTOCOL_ERROR; const E_COMMAND_FAILURE = class extends RedisError { constructor(message, origin = null) { super('command_failure', message, origin); } }; exports.E_COMMAND_FAILURE = E_COMMAND_FAILURE; const E_CONN_LOST = class extends RedisError { constructor(origin = null) { super('conn_lost', 'Lost the connection to remote server.', origin); } }; exports.E_CONN_LOST = E_CONN_LOST; const E_CONNECT_FAILED = class extends RedisError { constructor(origin = null) { super('connect_failed', 'Failed to connect to Redis server.', origin); } }; exports.E_CONNECT_FAILED = E_CONNECT_FAILED; const E_COMMAND_QUEUE_FULL = class extends RedisError { constructor(origin = null) { super('command_queue_full', 'The queue of commands is full.', origin); } }; exports.E_COMMAND_QUEUE_FULL = E_COMMAND_QUEUE_FULL; const E_COMMAND_TIMEOUT = class extends RedisError { constructor(origin = null) { super('command_timeout', 'There was no response for commands in time .', origin); } }; exports.E_COMMAND_TIMEOUT = E_COMMAND_TIMEOUT; const E_CONNECT_TIMEOUT = class extends RedisError { constructor(origin = null) { super('connect_timeout', 'Timeout while connecting to server.', origin); } }; exports.E_CONNECT_TIMEOUT = E_CONNECT_TIMEOUT; const E_INVALID_PARAM = class extends RedisError { constructor(origin = null) { super('invalid_param', 'The parameters passed to the command is unacceptable.', origin); } }; exports.E_INVALID_PARAM = E_INVALID_PARAM; const E_NOT_MULTI_MODE = class extends RedisError { constructor(origin = null) { super('not_multi_mode', 'The client is not under multi mode, please call multi method first.', origin); } }; exports.E_NOT_MULTI_MODE = E_NOT_MULTI_MODE; //# sourceMappingURL=Errors.js.map