patch exception handling