1.0.0 • Published 10 months ago

@megaorm/errors v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

MegaORM Errors

This package provides custom error classes for handling transaction, connection, and queue management issues in MegaORM, providing a consistent way to report failures.

Installation

To install the @megaorm/errors package, run the following command:

npm install @megaorm/errors

Errors

This package defines the following error classes:

new BeginTransactionError(message?: string)

Represents an error that occurs when starting a database transaction.

new CommitTransactionError(message?: string)

Represents an error that occurs when committing a database transaction.

new RollbackTransactionError(message?: string)

Represents an error that occurs when rolling back a database transaction.

new CloseConnectionError(message?: string)

Represents an error that occurs when closing a database connection.

new CreateConnectionError(message?: string)

Represents an error that occurs when creating a database connection.

new MaxConnectionError(message?: string)

Represents an error when the maximum number of database connections is exceeded.

new MaxQueueSizeError(message?: string)

Represents an error when the maximum queue size is exceeded.

new MaxQueueTimeError(message?: string)

Represents an error when the maximum allowed queue time is exceeded.

new QueryError(message?: string)

Represents an error that occurs during query execution.

new ShutdownError(message?: string)

Represents an error that occurs during shutdown.

Default Error Messages

Each error class has a default message that is used if no custom message is provided. Below are the default messages for each error:

  • BeginTransactionError: 'Begin transaction failed'
  • CommitTransactionError: 'Commit transaction failed'
  • RollbackTransactionError: 'Rollback transaction failed'
  • CloseConnectionError: 'Close connection failed'
  • CreateConnectionError: 'Create connection failed'
  • MaxConnectionError: 'Max number of connections passed'
  • MaxQueueSizeError: 'Max queue size passed'
  • MaxQueueTimeError: 'Max queue time passed'
  • QueryError: 'Query execution failed'
  • ShutdownError: 'Shutdown failed'