summaryrefslogtreecommitdiff
path: root/astroid/exceptions.py
diff options
context:
space:
mode:
authorClaudiu Popa <cpopa@cloudbasesolutions.com>2015-05-03 09:21:04 +0300
committerClaudiu Popa <cpopa@cloudbasesolutions.com>2015-05-03 09:21:04 +0300
commit0199ae820b6438873f3e5c4ce2adbac05f69841b (patch)
treed0988372028076c7cfb61d2bcdfdb6eaf554db15 /astroid/exceptions.py
parent328fa2e1b8d6e7a0dde737308b98e24249b36bd0 (diff)
downloadastroid-git-0199ae820b6438873f3e5c4ce2adbac05f69841b.tar.gz
Add two new exceptions for handling MRO error cases.
DuplicateBasesError is emitted when duplicate bases are found in a class, InconsistentMroError is raised when the method resolution is determined to be inconsistent. They share a common class, MroError, which is a subclass of ResolveError, meaning that this change is backwards compatible.
Diffstat (limited to 'astroid/exceptions.py')
-rw-r--r--astroid/exceptions.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/astroid/exceptions.py b/astroid/exceptions.py
index 3889e2e7..d1094cec 100644
--- a/astroid/exceptions.py
+++ b/astroid/exceptions.py
@@ -30,6 +30,18 @@ class AstroidBuildingException(AstroidError):
class ResolveError(AstroidError):
"""base class of astroid resolution/inference error"""
+class MroError(ResolveError):
+ """Error raised when there is a problem with method resolution of a class."""
+
+
+class DuplicateBasesError(MroError):
+ """Error raised when there are duplicate bases in the same class bases."""
+
+
+class InconsistentMroError(MroError):
+ """Error raised when a class's MRO is inconsistent."""
+
+
class NotFoundError(ResolveError):
"""raised when we are unable to resolve a name"""