public function addError(Exception $error)
    {
        $errorNode = $this->addElement("error", $error->getMessage());

        if (!$error instanceof NoRecordsMatchException) {
            $this->status = '400';
        }

        if ($error->getErrorName()) {
            $errorNode->setAttribute("code", $error->getErrorName());
        } else {
            $errorNode->setAttribute("code", "badArgument");
        }
    }