summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--astroid/decorators.py1
-rw-r--r--astroid/scoped_nodes.py7
2 files changed, 5 insertions, 3 deletions
diff --git a/astroid/decorators.py b/astroid/decorators.py
index 27ce983..815b540 100644
--- a/astroid/decorators.py
+++ b/astroid/decorators.py
@@ -129,5 +129,6 @@ def raise_if_nothing_inferred(func, instance, args, kwargs):
yield node
except exceptions.DefaultStop as e:
fields = vars(e)
+ del fields['message']
if not inferred:
raise exceptions.InferenceError(**fields)
diff --git a/astroid/scoped_nodes.py b/astroid/scoped_nodes.py
index eb7baf7..9b52135 100644
--- a/astroid/scoped_nodes.py
+++ b/astroid/scoped_nodes.py
@@ -91,10 +91,11 @@ def remove_nodes(cls):
def decorator(func, instance, args, kwargs):
nodes = [n for n in func(*args, **kwargs) if not isinstance(n, cls)]
if not nodes:
- # TODO: no way to access the name or context when raising
- # this error.
+ # TODO: no way to access the context when raising this error.
raise exceptions.AttributeInferenceError(
- 'No nodes left after filtering.', target=instance)
+ 'No nodes left after removing all {remove_type!r} from '
+ 'inferring for {node!r}.',
+ node=instance, remove_type=cls)
return nodes
return decorator