-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This new event token allows to hook into various errors that are thrown when working with the `Database` abstraction and their adapter. For example, a user can now listen to connection errors, or on errors from a query, or from the unit of work. ```typescript const database = new Database(new Adapter()); database.listen(onDatabaseError, (event) => { if (event.error instanceof MongoConnectionError) { // connection could not be established } // event.query/event.classSchema is set if it originated from a query }); ``` In general event.error could contain anything, is from subclass `DatabaseError` if it was related to database operations there were correctly wrapped by the adapter. Various specialisation errors that extends DatabaseError exist in various adapters like e.g. MongoConnectionError and MongoDatabaseError. The event is of type DatabaseErrorEvent, but has specialisations for unit of work errors DatabaseErrorInsertEvent and DatabaseErrorUpdateEvent with more information available.
- Loading branch information
Showing
15 changed files
with
411 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.