2a32681036
Currently migrate.versioning.api.upgrade() raises KeyError instead of sqlalchemy-migrate specific exception if migration script file is not present in migration repository. Raised migrate.exception.VersionNotFoundError if the specified migration script does not exist in the repository. Made VersionNotFoundError exception class as a subclass of KeyError in order to avoid breaking existing users looking for KeyError. Related-Bug: #1546441 Change-Id: I0210d56a6e85f03c44cea027f50863faaf050c1d
92 lines
1.9 KiB
Python
92 lines
1.9 KiB
Python
"""
|
|
Provide exception classes for :mod:`migrate`
|
|
"""
|
|
|
|
|
|
class Error(Exception):
|
|
"""Error base class."""
|
|
|
|
|
|
class ApiError(Error):
|
|
"""Base class for API errors."""
|
|
|
|
|
|
class KnownError(ApiError):
|
|
"""A known error condition."""
|
|
|
|
|
|
class UsageError(ApiError):
|
|
"""A known error condition where help should be displayed."""
|
|
|
|
|
|
class ControlledSchemaError(Error):
|
|
"""Base class for controlled schema errors."""
|
|
|
|
|
|
class InvalidVersionError(ControlledSchemaError):
|
|
"""Invalid version number."""
|
|
|
|
|
|
class VersionNotFoundError(KeyError):
|
|
"""Specified version is not present."""
|
|
|
|
|
|
class DatabaseNotControlledError(ControlledSchemaError):
|
|
"""Database should be under version control, but it's not."""
|
|
|
|
|
|
class DatabaseAlreadyControlledError(ControlledSchemaError):
|
|
"""Database shouldn't be under version control, but it is"""
|
|
|
|
|
|
class WrongRepositoryError(ControlledSchemaError):
|
|
"""This database is under version control by another repository."""
|
|
|
|
|
|
class NoSuchTableError(ControlledSchemaError):
|
|
"""The table does not exist."""
|
|
|
|
|
|
class PathError(Error):
|
|
"""Base class for path errors."""
|
|
|
|
|
|
class PathNotFoundError(PathError):
|
|
"""A path with no file was required; found a file."""
|
|
|
|
|
|
class PathFoundError(PathError):
|
|
"""A path with a file was required; found no file."""
|
|
|
|
|
|
class RepositoryError(Error):
|
|
"""Base class for repository errors."""
|
|
|
|
|
|
class InvalidRepositoryError(RepositoryError):
|
|
"""Invalid repository error."""
|
|
|
|
|
|
class ScriptError(Error):
|
|
"""Base class for script errors."""
|
|
|
|
|
|
class InvalidScriptError(ScriptError):
|
|
"""Invalid script error."""
|
|
|
|
|
|
class InvalidVersionError(Error):
|
|
"""Invalid version error."""
|
|
|
|
# migrate.changeset
|
|
|
|
class NotSupportedError(Error):
|
|
"""Not supported error"""
|
|
|
|
|
|
class InvalidConstraintError(Error):
|
|
"""Invalid constraint error"""
|
|
|
|
class MigrateDeprecationWarning(DeprecationWarning):
|
|
"""Warning for deprecated features in Migrate"""
|