From 7068d917a619d5cc2a713fcefeb4a70f9437ccba Mon Sep 17 00:00:00 2001 From: Mikko Korpela Date: Sun, 9 Oct 2022 18:37:11 +0300 Subject: [PATCH] improve type error descriptions --- overrides/enforce.py | 2 +- overrides/overrides.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/overrides/enforce.py b/overrides/enforce.py index 4db3c67..56a91cd 100644 --- a/overrides/enforce.py +++ b/overrides/enforce.py @@ -31,7 +31,7 @@ def _check_if_overrides_without_overrides_decorator(name, value, bases): continue if not is_override: raise TypeError( - f"Method {name} overrides but does not have @overrides decorator" + f"Method {name} overrides method from {base} but does not have @overrides decorator" ) @staticmethod diff --git a/overrides/overrides.py b/overrides/overrides.py index 2dbd42d..49eb014 100644 --- a/overrides/overrides.py +++ b/overrides/overrides.py @@ -127,7 +127,7 @@ def _validate_method(method, super_class, check_signature): if hasattr(super_method, "__finalized__"): finalized = getattr(super_method, "__finalized__") if finalized: - raise TypeError(f"{method.__name__}: is finalized") + raise TypeError(f"{method.__name__}: is finalized in {super_class}") if not method.__doc__: method.__doc__ = super_method.__doc__ if (