added error handler for task cancellation