public function getErrorMessage()
    {
        $result = '';
        switch ($this->getBodyType())
        {
            case 'json':
                $obj = json_decode($this->body);
                $statusCode = $obj->errorResponse->statusCode;
                $status = $obj->errorResponse->status;
                $message = $obj->errorResponse->message;
                $result = 'Error ' . $statusCode . ': ' . $status . ' - ' . $message;
                break;
            case 'xml':
                $dom = new \DOMDocument($this->body);
                $dom->loadXML($this->body);
                // $statusCode = $dom->getElementsByTagNameNS('http://marklogic.com/rest-api', 'status-code')->item(0)->nodeValue;
                // $status = $dom->getElementsByTagNameNS('http://marklogic.com/rest-api', 'status')->item(0)->nodeValue;
                // $message = $dom->getElementsByTagNameNS('http://marklogic.com/rest-api', 'message')->item(0)->nodeValue;
                // $result = 'Error ' . $statusCode . ': ' . $status . ' - ' . $message;
                // @todo XML won't necessarily be http://marklogic.com/rest-api format
                // For now, just return body of response
                $result = 'Error: ' . $this->body;
                break;
            default:
                $result = 'Error: ' . $this->body;
        }
        return $result;
    }