changeset 475:72cca077abf8

removal of HttpException
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 15 Jul 2013 17:32:47 +0200
parents a9693dc7089c
children 4aae0261515e
files CMakeLists.txt Core/HttpServer/HttpOutput.cpp OrthancCppClient/HttpClient.cpp OrthancCppClient/HttpClient.h
diffstat 4 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Mon Jul 15 17:25:53 2013 +0200
+++ b/CMakeLists.txt	Mon Jul 15 17:32:47 2013 +0200
@@ -153,7 +153,6 @@
   Core/Lua/LuaFunctionCall.cpp
 
   OrthancCppClient/HttpClient.cpp
-  OrthancCppClient/HttpException.cpp
   )  
 
 
--- a/Core/HttpServer/HttpOutput.cpp	Mon Jul 15 17:25:53 2013 +0200
+++ b/Core/HttpServer/HttpOutput.cpp	Mon Jul 15 17:32:47 2013 +0200
@@ -38,7 +38,6 @@
 #include <boost/lexical_cast.hpp>
 #include "../OrthancException.h"
 #include "../Toolbox.h"
-#include "../../OrthancCppClient/HttpException.h"
 
 namespace Orthanc
 {
--- a/OrthancCppClient/HttpClient.cpp	Mon Jul 15 17:25:53 2013 +0200
+++ b/OrthancCppClient/HttpClient.cpp	Mon Jul 15 17:32:47 2013 +0200
@@ -27,6 +27,9 @@
 
 #include "HttpClient.h"
 
+#include "../Core/Toolbox.h"
+#include "../Core/OrthancException.h"
+
 #include <string.h>
 #include <curl/curl.h>
 
@@ -44,8 +47,7 @@
   {
     if (code != CURLE_OK)
     {
-      //printf("ICI: %s\n", curl_easy_strerror(code));
-      throw HttpException("CURL: " + std::string(curl_easy_strerror(code)));
+      throw OrthancException("libCURL error: " + std::string(curl_easy_strerror(code)));
     }
 
     return code;
@@ -74,14 +76,14 @@
     pimpl_->postHeaders_ = NULL;
     if ((pimpl_->postHeaders_ = curl_slist_append(pimpl_->postHeaders_, "Expect:")) == NULL)
     {
-      throw HttpException("HttpClient: Not enough memory");
+      throw OrthancException(ErrorCode_NotEnoughMemory);
     }
 
     pimpl_->curl_ = curl_easy_init();
     if (!pimpl_->curl_)
     {
       curl_slist_free_all(pimpl_->postHeaders_);
-      throw HttpException("HttpClient: Not enough memory");
+      throw OrthancException(ErrorCode_NotEnoughMemory);
     }
 
     CheckCode(curl_easy_setopt(pimpl_->curl_, CURLOPT_WRITEFUNCTION, &CurlCallback));
@@ -193,7 +195,7 @@
       break;
 
     default:
-      throw HttpException("HttpClient: Internal error");
+      throw OrthancException(ErrorCode_InternalError);
     }
 
     // Do the actual request
@@ -247,4 +249,9 @@
   {
     curl_global_cleanup();
   }
+
+  const char* HttpClient::GetLastStatusText() const
+  {
+    return Toolbox::ToString(lastStatus_);
+  }
 }
--- a/OrthancCppClient/HttpClient.h	Mon Jul 15 17:25:53 2013 +0200
+++ b/OrthancCppClient/HttpClient.h	Mon Jul 15 17:32:47 2013 +0200
@@ -27,9 +27,7 @@
 
 #pragma once
 
-#include "HttpException.h"
-
-#include "../Core/Toolbox.h"
+#include "../Core/Enumerations.h"
 
 #include <string>
 #include <boost/shared_ptr.hpp>
@@ -112,10 +110,7 @@
       return lastStatus_;
     }
 
-    const char* GetLastStatusText() const
-    {
-      return Toolbox::ToString(lastStatus_);
-    }
+    const char* GetLastStatusText() const;
 
     void SetCredentials(const char* username,
                         const char* password);