catch the exception if we're doing async writing and log the error