diff options
Diffstat (limited to 'astroid/node_classes.py')
-rw-r--r-- | astroid/node_classes.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/astroid/node_classes.py b/astroid/node_classes.py index 7da41f5..5a92210 100644 --- a/astroid/node_classes.py +++ b/astroid/node_classes.py @@ -412,7 +412,8 @@ class NodeNG(object): def _infer(self, context=None): """we don't know how to resolve a statement by default""" # this method is overridden by most concrete classes - raise exceptions.InferenceError(self.__class__.__name__) + raise exceptions.InferenceError('No inference function for {node!r}.', + node=self, context=context) def inferred(self): '''return list of inferred values for a more simple inference usage''' @@ -894,7 +895,7 @@ class Arguments(mixins.AssignTypeMixin, NodeNG): i = _find_arg(argname, self.kwonlyargs)[0] if i is not None and self.kw_defaults[i] is not None: return self.kw_defaults[i] - raise exceptions.NoDefault() + raise exceptions.NoDefault(func=self.parent, name=argname) def is_argument(self, name): """return True if the name is defined in arguments""" @@ -1011,13 +1012,13 @@ class AugAssign(mixins.AssignTypeMixin, Statement): def type_errors(self, context=None): """Return a list of TypeErrors which can occur during inference. - Each TypeError is represented by a :class:`BinaryOperationError`, + Each TypeError is represented by a :class:`BadBinaryOperationMessage`, which holds the original exception. """ try: results = self._infer_augassign(context=context) return [result for result in results - if isinstance(result, exceptions.BinaryOperationError)] + if isinstance(result, util.BadBinaryOperationMessage)] except exceptions.InferenceError: return [] @@ -1053,13 +1054,13 @@ class BinOp(NodeNG): def type_errors(self, context=None): """Return a list of TypeErrors which can occur during inference. - Each TypeError is represented by a :class:`BinaryOperationError`, + Each TypeError is represented by a :class:`BadBinaryOperationMessage`, which holds the original exception. """ try: results = self._infer_binop(context=context) return [result for result in results - if isinstance(result, exceptions.BinaryOperationError)] + if isinstance(result, util.BadBinaryOperationMessage)] except exceptions.InferenceError: return [] @@ -1745,13 +1746,13 @@ class UnaryOp(NodeNG): def type_errors(self, context=None): """Return a list of TypeErrors which can occur during inference. - Each TypeError is represented by a :class:`UnaryOperationError`, + Each TypeError is represented by a :class:`BadUnaryOperationMessage`, which holds the original exception. """ try: results = self._infer_unaryop(context=context) return [result for result in results - if isinstance(result, exceptions.UnaryOperationError)] + if isinstance(result, util.BadUnaryOperationMessage)] except exceptions.InferenceError: return [] |