diff --git a/src/typeguard/_checkers.py b/src/typeguard/_checkers.py index aa72b6c..5856cf9 100644 --- a/src/typeguard/_checkers.py +++ b/src/typeguard/_checkers.py @@ -445,6 +445,7 @@ def check_uniontype( ) finally: del errors # avoid creating ref cycle + raise TypeCheckError(f"did not match any element in the union:\n{formatted_errors}")