This repository was archived by the owner on Jun 18, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -113,9 +113,20 @@ namespace arangodb { namespace fuerte { namespace php {
113113
114114 auto response = new Response (*result);
115115
116+ bool failure = false ;
117+ if (response->getFuerteResponse ()->slices ().front ().isObject ()) {
118+ failure = response->getFuerteResponse ()->slices ().front ().get (" error" ).getBool ();
119+ }
120+
116121 auto statusCode = response->getHttpCode ();
117- if ((!(statusCode >= 200 && statusCode <= 299 ))/* || response->getFuerteResponse()->slices().front().get("error").getBool()*/ ) {
118- throwRequestFailedException (" This is the error message" , statusCode, response->getBody ());
122+ if ((!(statusCode >= 200 && statusCode <= 299 )) || failure) {
123+ std::string errorMessage = " Response contains an error" ;
124+
125+ if (response->getFuerteResponse ()->slices ().front ().isObject ()) {
126+ errorMessage = response->getFuerteResponse ()->slices ().front ().get (" errorMessage" ).copyString ();
127+ }
128+
129+ throwRequestFailedException (errorMessage.c_str (), statusCode, response->getBody ());
119130 }
120131
121132 return response;
You can’t perform that action at this time.
0 commit comments