aiida.common.exceptions 源代码

###########################################################################
# Copyright (c), The AiiDA team. All rights reserved.                     #
# This file is part of the AiiDA code.                                    #
#                                                                         #
# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core #
# For further information on the license, see the LICENSE.txt file        #
# For further information please visit http://www.aiida.net               #
###########################################################################
"""Module that define the exceptions that are thrown by AiiDA's internal code."""

__all__ = (
    'AiidaException',
    'NotExistent',
    'NotExistentAttributeError',
    'NotExistentKeyError',
    'MultipleObjectsError',
    'RemoteOperationError',
    'ContentNotExistent',
    'FailedError',
    'StoringNotAllowed',
    'ModificationNotAllowed',
    'IntegrityError',
    'UniquenessError',
    'EntryPointError',
    'MissingEntryPointError',
    'MultipleEntryPointError',
    'LoadingEntryPointError',
    'InvalidEntryPointTypeError',
    'InvalidOperation',
    'ParsingError',
    'InternalError',
    'PluginInternalError',
    'ValidationError',
    'ConfigurationError',
    'ProfileConfigurationError',
    'MissingConfigurationError',
    'ConfigurationVersionError',
    'IncompatibleStorageSchema',
    'CorruptStorage',
    'DbContentError',
    'InputValidationError',
    'FeatureNotAvailable',
    'FeatureDisabled',
    'LicensingException',
    'TestsNotAllowedError',
    'UnsupportedSpeciesError',
    'TransportTaskException',
    'OutputParsingError',
    'HashingError',
    'StorageMigrationError',
    'StorageBackupError',
    'LockedProfileError',
    'LockingProfileError',
    'ClosedStorage',
)


[文档] class AiidaException(Exception): # noqa: N818 """Base class for all AiiDA exceptions. Each module will have its own subclass, inherited from this (e.g. ExecManagerException, TransportException, ...) """
[文档] class NotExistent(AiidaException): """Raised when the required entity does not exist."""
[文档] class NotExistentAttributeError(AttributeError, NotExistent): """Raised when the required entity does not exist, when fetched as an attribute."""
[文档] class NotExistentKeyError(KeyError, NotExistent): """Raised when the required entity does not exist, when fetched as a dictionary key."""
[文档] class MultipleObjectsError(AiidaException): """Raised when more than one entity is found in the DB, but only one was expected. """
[文档] class RemoteOperationError(AiidaException): """Raised when an error in a remote operation occurs, as in a failed kill() of a scheduler job. """
[文档] class ContentNotExistent(NotExistent): """Raised when trying to access an attribute, a key or a file in the result nodes that is not present """
[文档] class FailedError(AiidaException): """Raised when accessing a calculation that is in the FAILED status"""
[文档] class StoringNotAllowed(AiidaException): """Raised when the user tries to store an unstorable node (e.g. a base Node class)"""
[文档] class ModificationNotAllowed(AiidaException): """Raised when the user tries to modify a field, object, property, ... that should not be modified. """
[文档] class IntegrityError(AiidaException): """Raised when there is an underlying data integrity error. This can be database related or a general data integrity error. This can happen if, e.g., a foreign key check fails. See PEP 249 for details. """
[文档] class UniquenessError(AiidaException): """Raised when the user tries to violate a uniqueness constraint (on the DB, for instance). """
[文档] class EntryPointError(AiidaException): """Raised when an entry point cannot be uniquely resolved and imported."""
[文档] class MissingEntryPointError(EntryPointError): """Raised when the requested entry point is not registered with the entry point manager."""
[文档] class MultipleEntryPointError(EntryPointError): """Raised when the requested entry point cannot uniquely be resolved by the entry point manager."""
[文档] class LoadingEntryPointError(EntryPointError): """Raised when the resource corresponding to requested entry point cannot be imported."""
[文档] class InvalidEntryPointTypeError(EntryPointError): """Raised when a loaded entry point has a type that is not supported by the corresponding entry point group."""
[文档] class InvalidOperation(AiidaException): """The allowed operation is not valid (e.g., when trying to add a non-internal attribute before saving the entry), or deleting an entry that is protected (e.g., because it is referenced by foreign keys) """
[文档] class ParsingError(AiidaException): """Generic error raised when there is a parsing error"""
[文档] class InternalError(AiidaException): """Error raised when there is an internal error of AiiDA."""
[文档] class PluginInternalError(InternalError): """Error raised when there is an internal error which is due to a plugin and not to the AiiDA infrastructure. """
[文档] class ValidationError(AiidaException): """Error raised when there is an error during the validation phase of a property. """
[文档] class ConfigurationError(AiidaException): """Error raised when there is a configuration error in AiiDA."""
[文档] class ProfileConfigurationError(ConfigurationError): """Configuration error raised when a wrong/inexistent profile is requested."""
[文档] class MissingConfigurationError(ConfigurationError): """Configuration error raised when the configuration file is missing."""
[文档] class ConfigurationVersionError(ConfigurationError): """Configuration error raised when the configuration file version is not compatible with the current version. """
[文档] class ClosedStorage(AiidaException): """Raised when trying to access data from a closed storage backend."""
[文档] class UnreachableStorage(ConfigurationError): # noqa: N818 """Raised when a connection to the storage backend fails."""
[文档] class IncompatibleDatabaseSchema(ConfigurationError): # noqa: N818 """Raised when the storage schema is incompatible with that of the code. Deprecated for ``IncompatibleStorageSchema`` """
[文档] class IncompatibleStorageSchema(IncompatibleDatabaseSchema): """Raised when the storage schema is incompatible with that of the code."""
[文档] class CorruptStorage(ConfigurationError): # noqa: N818 """Raised when the storage is not found to be internally consistent on validation."""
[文档] class DatabaseMigrationError(AiidaException): """Raised if a critical error is encountered during a storage migration. Deprecated for ``StorageMigrationError`` """
[文档] class StorageMigrationError(DatabaseMigrationError): """Raised if a critical error is encountered during a storage migration."""
[文档] class StorageBackupError(AiidaException): """Raised if a critical error is encountered during a storage backup."""
[文档] class DbContentError(AiidaException): """Raised when the content of the DB is not valid. This should never happen if the user does not play directly with the DB. """
[文档] class InputValidationError(ValidationError): """The input data for a calculation did not validate (e.g., missing required input data, wrong data, ...) """
[文档] class FeatureNotAvailable(AiidaException): """Raised when a feature is requested from a plugin, that is not available."""
[文档] class FeatureDisabled(AiidaException): """Raised when a feature is requested, but the user has chosen to disable it (e.g., for submissions on disabled computers). """
[文档] class LicensingException(AiidaException): """Raised when requirements for data licensing are not met."""
[文档] class TestsNotAllowedError(AiidaException): """Raised when tests are required to be run/loaded, but we are not in a testing environment. This is to prevent data loss. """
[文档] class UnsupportedSpeciesError(ValueError): """Raised when StructureData operations are fed species that are not supported by AiiDA such as Deuterium"""
[文档] class TransportTaskException(AiidaException): """Raised when a TransportTask, an task to be completed by the engine that requires transport, fails"""
[文档] class OutputParsingError(ParsingError): """Can be raised by a Parser when it fails to parse the output generated by a `CalcJob` process."""
[文档] class CircusCallError(AiidaException): """Raised when an attempt to contact Circus returns an error in the response"""
[文档] class HashingError(AiidaException): """Raised when an attempt to hash an object fails via a known failure mode"""
[文档] class LockedProfileError(AiidaException): """Raised if attempting to access a locked profile"""
[文档] class LockingProfileError(AiidaException): """Raised if the profile can`t be locked"""