@mikro-orm/core
Version:
TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.
132 lines (131 loc) • 5.42 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UniqueConstraintViolationException = exports.TableNotFoundException = exports.TableExistsException = exports.SyntaxErrorException = exports.ReadOnlyException = exports.NotNullConstraintViolationException = exports.NonUniqueFieldNameException = exports.LockWaitTimeoutException = exports.InvalidFieldNameException = exports.CheckConstraintViolationException = exports.ForeignKeyConstraintViolationException = exports.DeadlockException = exports.DatabaseObjectNotFoundException = exports.DatabaseObjectExistsException = exports.ConstraintViolationException = exports.ServerException = exports.ConnectionException = exports.DriverException = void 0;
/**
* Base class for all errors detected in the driver.
*/
class DriverException extends Error {
code;
errno;
sqlState;
sqlMessage;
errmsg;
constructor(previous) {
super(previous.message);
Object.getOwnPropertyNames(previous).forEach(k => this[k] = previous[k]);
this.name = this.constructor.name;
Error.captureStackTrace(this, this.constructor);
this.stack += '\n\n' + previous.stack.split('\n').filter(l => l.trim().startsWith('at ')).join('\n');
}
}
exports.DriverException = DriverException;
/**
* Base class for all connection related errors detected in the driver.
*/
class ConnectionException extends DriverException {
}
exports.ConnectionException = ConnectionException;
/**
* Base class for all server related errors detected in the driver.
*/
class ServerException extends DriverException {
}
exports.ServerException = ServerException;
/**
* Base class for all constraint violation related errors detected in the driver.
*/
class ConstraintViolationException extends ServerException {
}
exports.ConstraintViolationException = ConstraintViolationException;
/**
* Base class for all already existing database object related errors detected in the driver.
*
* A database object is considered any asset that can be created in a database
* such as schemas, tables, views, sequences, triggers, constraints, indexes,
* functions, stored procedures etc.
*/
class DatabaseObjectExistsException extends ServerException {
}
exports.DatabaseObjectExistsException = DatabaseObjectExistsException;
/**
* Base class for all unknown database object related errors detected in the driver.
*
* A database object is considered any asset that can be created in a database
* such as schemas, tables, views, sequences, triggers, constraints, indexes,
* functions, stored procedures etc.
*/
class DatabaseObjectNotFoundException extends ServerException {
}
exports.DatabaseObjectNotFoundException = DatabaseObjectNotFoundException;
/**
* Exception for a deadlock error of a transaction detected in the driver.
*/
class DeadlockException extends ServerException {
}
exports.DeadlockException = DeadlockException;
/**
* Exception for a foreign key constraint violation detected in the driver.
*/
class ForeignKeyConstraintViolationException extends ConstraintViolationException {
}
exports.ForeignKeyConstraintViolationException = ForeignKeyConstraintViolationException;
/**
* Exception for a check constraint violation detected in the driver.
*/
class CheckConstraintViolationException extends ConstraintViolationException {
}
exports.CheckConstraintViolationException = CheckConstraintViolationException;
/**
* Exception for an invalid specified field name in a statement detected in the driver.
*/
class InvalidFieldNameException extends ServerException {
}
exports.InvalidFieldNameException = InvalidFieldNameException;
/**
* Exception for a lock wait timeout error of a transaction detected in the driver.
*/
class LockWaitTimeoutException extends ServerException {
}
exports.LockWaitTimeoutException = LockWaitTimeoutException;
/**
* Exception for a non-unique/ambiguous specified field name in a statement detected in the driver.
*/
class NonUniqueFieldNameException extends ServerException {
}
exports.NonUniqueFieldNameException = NonUniqueFieldNameException;
/**
* Exception for a NOT NULL constraint violation detected in the driver.
*/
class NotNullConstraintViolationException extends ConstraintViolationException {
}
exports.NotNullConstraintViolationException = NotNullConstraintViolationException;
/**
* Exception for a write operation attempt on a read-only database element detected in the driver.
*/
class ReadOnlyException extends ServerException {
}
exports.ReadOnlyException = ReadOnlyException;
/**
* Exception for a syntax error in a statement detected in the driver.
*/
class SyntaxErrorException extends ServerException {
}
exports.SyntaxErrorException = SyntaxErrorException;
/**
* Exception for an already existing table referenced in a statement detected in the driver.
*/
class TableExistsException extends DatabaseObjectExistsException {
}
exports.TableExistsException = TableExistsException;
/**
* Exception for an unknown table referenced in a statement detected in the driver.
*/
class TableNotFoundException extends DatabaseObjectNotFoundException {
}
exports.TableNotFoundException = TableNotFoundException;
/**
* Exception for a unique constraint violation detected in the driver.
*/
class UniqueConstraintViolationException extends ConstraintViolationException {
}
exports.UniqueConstraintViolationException = UniqueConstraintViolationException;