Exceptions¶
nextorm exception hierarchy.
- exception nextorm.exceptions.MappingError[source]¶
Bases:
ExceptionRaised when entity relation wiring is invalid or ambiguous.
Thrown by
generate_mapping()when:A
Set[T]attribute has no matching back-reference onT.Multiple relations between the same two entities exist without an explicit
reverse=attribute to resolve the ambiguity.
- exception nextorm.exceptions.ObjectNotFound[source]¶
Bases:
ExceptionRaised by
get_or_raise()when no row matches.Example:
user = db.select(User).filter(User.id == 99).get_or_raise() # → ObjectNotFound: User matching the given filter was not found.
- exception nextorm.exceptions.MultipleObjectsFoundError[source]¶
Bases:
ExceptionRaised by
get()orget_or_raise()when more than one row matches.Example:
# Multiple users named "alice" user = db.select(User).filter(User.name == "alice").get() # → MultipleObjectsFoundError: get() returned more than one User.
- exception nextorm.exceptions.ConstraintError[source]¶
Bases:
ExceptionRaised when a database constraint (UNIQUE, NOT NULL, FK) is violated.
Wraps the underlying DBAPI
IntegrityErrorso callers can catch a provider-independent exception type.
- exception nextorm.exceptions.TransactionError[source]¶
Bases:
ExceptionRaised for transaction-level problems (deadlock, serialization failure, session-is-over, etc.).
- exception nextorm.exceptions.OptimisticCheckError[source]¶
Bases:
ExceptionRaised when an optimistic version check fails on UPDATE.
A version check fails when the row’s current version in the database no longer matches the version the entity was loaded with — meaning another transaction updated the row concurrently.
Example:
alice = db.select(Article).filter(Article.id == 1).fetch_one() # ... another transaction updates article 1 and bumps its version ... alice.title = "New title" db.save(alice) # → OptimisticCheckError: concurrent update detected
- exception nextorm.exceptions.CommitException[source]¶
Bases:
TransactionErrorRaised when the primary-database commit fails during a staged commit.
The
exceptionsattribute contains the list of underlying exceptions that were collected (primary failure first, then any rollback failures).When this is raised all secondary databases have been rolled back.
- exception nextorm.exceptions.PartialCommitException[source]¶
Bases:
TransactionErrorRaised when the primary database committed but one or more secondary databases failed.
The primary database’s work is durable; the secondary failures are collected in
exceptions. Manual reconciliation may be required.