From f278315081b24b59bf73e9613e552e3519200a71 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Mon, 28 May 2012 04:39:18 +0000 Subject: Improve error reporting with a reason code. Improve debug and audit logging. Fix test scripts to cleanup state from previous builds and correctly report test errors. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1343138 13f79535-47bb-0310-9956-ffa450edef68 --- sca-cpp/trunk/modules/http/http.hpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'sca-cpp/trunk/modules/http/http.hpp') diff --git a/sca-cpp/trunk/modules/http/http.hpp b/sca-cpp/trunk/modules/http/http.hpp index eb7a8d506f..e8c88f8a83 100644 --- a/sca-cpp/trunk/modules/http/http.hpp +++ b/sca-cpp/trunk/modules/http/http.hpp @@ -371,7 +371,7 @@ template const failable > apply(const list >& h // Setup the CURL session const failable fch = setup(url, cs); if (!hasContent(fch)) - return mkfailure>(reason(fch)); + return mkfailure>(fch); CURL* ch = content(fch); // Set the request headers @@ -440,19 +440,19 @@ const failable evalExpr(const value& expr, const string& url, const CURLS js::JSContext cx; const failable > jsreq = json::jsonRequest(1, car(expr), cdr(expr), cx); if (!hasContent(jsreq)) - return mkfailure(reason(jsreq)); + return mkfailure(jsreq); // POST it to the URL const list h = mklist("Content-Type: application/json-rpc"); const failable > > res = apply >(mklist >(h, content(jsreq)), rcons, list(), url, "POST", cs); if (!hasContent(res)) - return mkfailure(reason(res)); + return mkfailure(res); // Parse and return JSON-RPC result const failable rval = json::jsonResultValue(cadr >(content(res)), cx); debug(rval, "http::evalExpr::result"); if (!hasContent(rval)) - return mkfailure(reason(rval)); + return mkfailure(rval); return content(rval); } @@ -513,7 +513,7 @@ const failable getcontent(const string& url, const CURLSession& cs) { // Get the contents of the resource at the given URL const failable > > res = get>(rcons, list(), url, cs); if (!hasContent(res)) - return mkfailure(reason(res)); + return mkfailure(res); const list ls(reverse(cadr(content(res)))); // Return the content as a list of values @@ -597,7 +597,7 @@ const failable get(const string& url, const CURLSession& cs) { // Get the contents of the resource at the given URL const failable > > res = get >(rcons, list(), url, cs); if (!hasContent(res)) - return mkfailure(reason(res)); + return mkfailure(res); // Parse the returned content return responseValue(content(res)); @@ -608,7 +608,7 @@ const failable get(const string& url, const CURLSession& cs) { */ const failable > > writeRequest(const failable >& ls, const string& ct) { if (!hasContent(ls)) - return mkfailure > >(reason(ls)); + return mkfailure > >(ls); const list > req = mklist >(mklist(string("Content-Type: ") + ct), content(ls)); debug(req, "http::writeRequest::req"); return req; @@ -695,13 +695,13 @@ const failable post(const value& val, const string& url, const CURLSessio // Convert value to a content request const failable > > req = contentRequest(val, url); if (!hasContent(req)) - return mkfailure(reason(req)); + return mkfailure(req); debug(content(req), "http::post::input"); // POST it to the URL const failable > > res = apply>(content(req), rcons, list(), url, "POST", cs); if (!hasContent(res)) - return mkfailure(reason(res)); + return mkfailure(res); // Return the new entry id from the HTTP location header, if any const string loc = location(car(content(res))); @@ -724,13 +724,13 @@ const failable put(const value& val, const string& url, const CURLSession // Convert value to a content request const failable > > req = contentRequest(val, url); if (!hasContent(req)) - return mkfailure(reason(req)); + return mkfailure(req); debug(content(req), "http::put::input"); // PUT it to the URL const failable > > res = apply >(content(req), rcons, list(), url, "PUT", cs); if (!hasContent(res)) - return mkfailure(reason(res)); + return mkfailure(res); debug(true, "http::put::result"); return value(true); @@ -745,13 +745,13 @@ const failable patch(const value& val, const string& url, const CURLSessi // Convert value to a content request const failable > > req = contentRequest(val, url); if (!hasContent(req)) - return mkfailure(reason(req)); + return mkfailure(req); debug(content(req), "http::patch::input"); // PATCH it to the URL const failable > > res = apply >(content(req), rcons, list(), url, "PATCH", cs); if (!hasContent(res)) - return mkfailure(reason(res)); + return mkfailure(res); debug(true, "http::patch::result"); return value(true); @@ -766,7 +766,7 @@ const failable del(const string& url, const CURLSession& cs) { const list > req = mklist(list(), list()); const failable > > res = apply >(req, rcons, list(), url, "DELETE", cs); if (!hasContent(res)) - return mkfailure(reason(res)); + return mkfailure(res); debug(true, "http::delete::result"); return value(true); @@ -805,7 +805,7 @@ const failable connect(const string& url, CURLSession& cs) { // Setup the CURL session const failable fch = setup(url, cs); if (!hasContent(fch)) - return mkfailure(reason(fch)); + return mkfailure(fch); CURL* ch = content(fch); // Connect -- cgit v1.2.3