Source code for forte.common.exception

# Copyright 2019 The Forte Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Forte defined exceptions.
"""

__all__ = [
    "PackIndexError",
    "IncompleteEntryError",
    "EntryNotFoundError",
    "ProcessorConfigError",
    "PackDataException",
    "ProcessFlowException",
    "ProcessExecutionException",
    "ValidationError",
    "ResourceError",
    "ExpectedRecordNotFound",
    "InvalidOperationException",
    "UnknownOntologyClassException",
    "InvalidForteStateException",
]


[docs]class PackIndexError(Exception): r"""Raise this error when there is a problem accessing the indexes pack data. """ pass
[docs]class IncompleteEntryError(Exception): r"""Raise this error when the entry is not complete.""" pass
[docs]class EntryNotFoundError(ValueError): r"""Raise this error when the entry is not found in the data pack.""" pass
[docs]class ProcessorConfigError(ValueError): r"""Raise this error when the there is a problem with the processor configuration. """ pass
[docs]class ResourceError(ValueError): r"""Raise this error when there are problems accessing Resources of the processor. """ pass
[docs]class PackDataException(Exception): r"""Raise this error when the data in pack is wrong.""" pass
[docs]class ProcessFlowException(Exception): r"""Raise this when errors happen in flow control""" pass
[docs]class ProcessExecutionException(Exception): r"""Raise this when process execution fail""" pass
[docs]class ValidationError(Exception): r"""Raise this error when input validate fail""" pass
[docs]class ExpectedRecordNotFound(ValueError): r"""Raise this error when expected type for input is not in input record""" pass
[docs]class InvalidOperationException(Exception): """Throw when a method call is invalid for the object's current state""" pass
[docs]class UnknownOntologyClassException(Exception): """Throw when there are unrecognized ontology class in the input""" pass
class InvalidForteStateException(Exception): """Certain Forte internal state is at an invalid state, such as not initialized.""" pass