Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added package specific base exception and base warning for EMMOntoPy #322

Merged
merged 4 commits into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ontopy/manchester.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# pylint: disable=unused-import,wrong-import-order
import pyparsing as pp
import ontopy # noqa F401 -- ontopy must be imported before owlready2
from ontopy.utils import EMMOntoPyException
import owlready2


Expand Down Expand Up @@ -75,7 +76,7 @@ def manchester_expression():
return expr


class ManchesterError(Exception):
class ManchesterError(EMMOntoPyException):
"""Raised on invalid Manchester notation."""


Expand Down
18 changes: 13 additions & 5 deletions ontopy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,33 @@
OWLREADY2_FORMATS = "rdfxml", "owl", "xml", "ntriples"


class IncompatibleVersion(Warning):
class EMMOntoPyException(Exception):
"""A BaseException class for EMMOntoPy"""


class EMMOntoPyWarning(Warning):
"""A BaseWarning class for EMMOntoPy"""


class IncompatibleVersion(EMMOntoPyWarning):
"""An installed dependency version may be incompatible with a functionality
of this package - or rather an outcome of a functionality.
This is not critical, hence this is only a warning."""


class UnknownVersion(Exception):
class UnknownVersion(EMMOntoPyException):
"""Cannot retrieve version from a package."""


class NoSuchLabelError(LookupError, AttributeError):
class NoSuchLabelError(LookupError, AttributeError, EMMOntoPyException):
"""Error raised when a label cannot be found."""


class LabelDefinitionError(Exception):
class LabelDefinitionError(EMMOntoPyException):
"""Error in label definition."""


class ThingClassDefinitionError(Exception):
class ThingClassDefinitionError(EMMOntoPyException):
"""Error in ThingClass definition."""


Expand Down