protected function throwError($reason) { if ($reason instanceof Error || $reason instanceof Exception) { throw $reason; } throw new CancellationException($reason); }