I figured it out, I should use swallow_errors.
with revit.Transaction("your_wish_is_my_command", swallow_errors=True):