contextlib.suppress swallows exceptions silently. Write a class Collect used as a context manager that suppresses the given exception types but records them:
errors = Collect(ValueError, KeyError)
with errors:
int("x")
errors.caught # [ValueError(...)]
with blocks and keeps appendingbool(errors) is True if anything was caught