Class Errors

View code

Sequelize provides a host of custom error classes, to allow you to do easier debugging. All of these errors are exposed on the sequelize object and the sequelize constructor.All sequelize errors inherit from the base JS error object.


new BaseError()

View code

The Base Error all Sequelize Errors inherit from.Aliases: Error


new ValidationError(message, [errors])

View code

Validation Error. Thrown when the sequelize validation has failed. The error contains an errors property,which is an array with 1 or more ValidationErrorItems, one for each validation that failed.

Params:

NameTypeDescription
messagestringError message
[errors]ArrayArray of ValidationErrorItem objects describing the validation errors

Extends: BaseError


errors

View code

An array of ValidationErrorItems


get(path)

View code

Gets all validation error items for the path / field specified.

Params:

NameTypeDescription
pathstringThe path to be checked for error items

new DatabaseError()

View code

A base class for all database related errors.

Extends: BaseError


parent

View code

The database specific error which triggered this one


sql

View code

The SQL that triggered the error


message()

View code

The message from the DB.


fields()

View code

The fields of the unique constraint


value()

View code

The value(s) which triggered the error


index()

View code

The name of the index that triggered the error


new TimeoutError()

View code

Thrown when a database query times out because of a deadlock

Extends: DatabaseError


new UniqueConstraintError()

View code

Thrown when a unique constraint is violated in the database

Extends: DatabaseError


new ForeignKeyConstraintError()

View code

Thrown when a foreign key constraint is violated in the database

Extends: DatabaseError


new ExclusionConstraintError()

View code

Thrown when an exclusion constraint is violated in the database

Extends: DatabaseError


new ValidationErrorItem(message, type, path, value)

View code

Validation Error ItemInstances of this class are included in the ValidationError.errors property.

Params:

NameTypeDescription
messagestringAn error message
typestringThe type of the validation error
pathstringThe field that triggered the validation error
valuestringThe value that generated the error

new ConnectionError()

View code

A base class for all connection related errors.

Extends: BaseError


parent

View code

The connection specific error which triggered this one


new ConnectionRefusedError()

View code

Thrown when a connection to a database is refused

Extends: ConnectionError


new AccessDeniedError()

View code

Thrown when a connection to a database is refused due to insufficient privileges

Extends: ConnectionError


new HostNotFoundError()

View code

Thrown when a connection to a database has a hostname that was not found

Extends: ConnectionError


new HostNotReachableError()

View code

Thrown when a connection to a database has a hostname that was not reachable

Extends: ConnectionError


new InvalidConnectionError()

View code

Thrown when a connection to a database has invalid values for any of the connection parameters

Extends: ConnectionError


new ConnectionTimedOutError()

View code

Thrown when a connection to a database times out

Extends: ConnectionError


new InstanceError()

View code

Thrown when a some problem occurred with Instance methods (see message for details)

Extends: BaseError


new EmptyResultError()

View code

Thrown when a record was not found, Usually used with rejectOnEmpty mode (see message for details)

Extends: BaseError


This document is automatically generated based on source code comments. Please do not edit it directly, as your changes will be ignored. Please write on IRC, open an issue or a create a pull request if you feel something can be improved. For help on how to write source code documentation see JSDoc and dox