public function errorAction()
    {
        try {
            $order = $this->getPaymentHandler()->handleError($this->getCurrentRequest(), $this->getBasket());
        } catch (EntityNotFoundException $ex) {
            throw new NotFoundHttpException($ex->getMessage());
        } catch (InvalidTransactionException $ex) {
            throw new UnauthorizedHttpException($ex->getMessage());
        }

        return $this->render('SonataPaymentBundle:Payment:error.html.twig', [
            'order' => $order,
        ]);
    }