UNPKG

@fluent-org/logger

Version:
151 lines 4.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FatalSocketError = exports.DecodeError = exports.SharedKeyMismatchError = exports.AuthError = exports.RetryShutdownError = exports.AckShutdownError = exports.QueueShutdownError = exports.DroppedError = exports.SocketNotWritableError = exports.SocketTimeoutError = exports.DataTypeError = exports.AckTimeoutError = exports.UnexpectedMessageError = exports.MissingTagError = exports.ConfigError = void 0; class BaseError extends Error { constructor(message) { super(); Error.captureStackTrace(this, this.constructor); this.name = this.constructor.name; this.message = message; } } /** * Thrown on configuration errors, e.g bad event modes */ class ConfigError extends BaseError { constructor(message) { super(message); } } exports.ConfigError = ConfigError; /** * Thrown when an event is emitted without either passing the tag to `client.emit` or providing a `tag_prefix`. */ class MissingTagError extends BaseError { constructor(message) { super(message); } } exports.MissingTagError = MissingTagError; /** * Thrown when a client/server receives an unexpected/invalid message */ class UnexpectedMessageError extends BaseError { constructor(message) { super(message); } } exports.UnexpectedMessageError = UnexpectedMessageError; /** * Thrown when a client waiting for an acknowledgement times out */ class AckTimeoutError extends BaseError { constructor(message) { super(message); } } exports.AckTimeoutError = AckTimeoutError; /** * Thrown when a client tries to emit an invalid data format, e.g string as timestamp, string event, etc. */ class DataTypeError extends BaseError { constructor(message) { super(message); } } exports.DataTypeError = DataTypeError; /** * Thrown when a socket times out, but in a weird state. */ class SocketTimeoutError extends BaseError { constructor(message) { super(message); } } exports.SocketTimeoutError = SocketTimeoutError; /** * Thrown when a client tries to write to a socket, but the socket is not writable */ class SocketNotWritableError extends BaseError { constructor(message) { super(message); } } exports.SocketNotWritableError = SocketNotWritableError; /** * Thrown when an event is dropped from the queue for any reason */ class DroppedError extends BaseError { constructor(message) { super(message); } } exports.DroppedError = DroppedError; /** * Thrown when an event is dropped as a result of clearing out the queue on shutdown * * Extends DroppedError since the message was dropped from the queue */ class QueueShutdownError extends DroppedError { constructor(message) { super(message); } } exports.QueueShutdownError = QueueShutdownError; /** * Thrown into the ack queue on shutdown, terminating all promises waiting for an ack */ class AckShutdownError extends BaseError { constructor(message) { super(message); } } exports.AckShutdownError = AckShutdownError; /** * Thrown when the EventRetrier is shut down */ class RetryShutdownError extends BaseError { constructor(message) { super(message); } } exports.RetryShutdownError = RetryShutdownError; /** * Thrown when authentication fails on either the client or the server */ class AuthError extends BaseError { constructor(message) { super(message); } } exports.AuthError = AuthError; /** * Thrown when the shared key doesn't match * * Extends AuthError, since the key was incorrect */ class SharedKeyMismatchError extends AuthError { constructor(message) { super(message); } } exports.SharedKeyMismatchError = SharedKeyMismatchError; /** * Thrown when a message could not be decoded properly */ class DecodeError extends BaseError { constructor(message) { super(message); } } exports.DecodeError = DecodeError; /** * Thrown when trying to call `connect()` on a fatal socket */ class FatalSocketError extends BaseError { constructor(message) { super(message); } } exports.FatalSocketError = FatalSocketError; //# sourceMappingURL=error.js.map