Decorator for retrying when exceptions occur