diff --git a/arangod/Cluster/ClusterComm.h b/arangod/Cluster/ClusterComm.h index c073742cc0..6674248353 100644 --- a/arangod/Cluster/ClusterComm.h +++ b/arangod/Cluster/ClusterComm.h @@ -92,7 +92,6 @@ struct ClusterCommResult { // is dropped whilst in state CL_COMM_SENDING // it is then actually dropped when it has // been sent - bool invalid; // can only explicitly be set bool single; // operation only needs a single round trip (and no request/ // response in the opposite direction @@ -110,7 +109,6 @@ struct ClusterCommResult { ClusterCommResult() : dropped(false), - invalid(false), single(false), answer_code(rest::HttpResponse::PROCESSING) {} diff --git a/arangod/Cluster/v8-cluster.cpp b/arangod/Cluster/v8-cluster.cpp index 39a2a8abe5..7549852d6d 100644 --- a/arangod/Cluster/v8-cluster.cpp +++ b/arangod/Cluster/v8-cluster.cpp @@ -1745,10 +1745,7 @@ static void Return_PrepareClusterCommResultForJS( TRI_V8_CURRENT_GLOBALS_AND_SCOPE; v8::Handle r = v8::Object::New(isolate); - if (res.invalid) { - TRI_GET_GLOBAL_STRING(ErrorMessageKey); - r->Set(ErrorMessageKey, TRI_V8_ASCII_STRING("out of memory")); - } else if (res.dropped) { + if (res.dropped) { TRI_GET_GLOBAL_STRING(ErrorMessageKey); r->Set(ErrorMessageKey, TRI_V8_ASCII_STRING("operation was dropped")); } else { @@ -1830,8 +1827,13 @@ static void Return_PrepareClusterCommResultForJS( TRI_GET_GLOBAL_STRING(ErrorMessageKey); r->Set(ErrorMessageKey, TRI_V8_ASCII_STRING("request dropped whilst waiting for answer")); - } else { // Everything is OK - TRI_ASSERT(res.status == CL_COMM_RECEIVED); + } else if (res.status == CL_COMM_BACKEND_UNAVAILABLE) { + TRI_GET_GLOBAL_STRING(StatusKey); + r->Set(StatusKey, TRI_V8_ASCII_STRING("BACKEND_UNAVAILABLE")); + TRI_GET_GLOBAL_STRING(ErrorMessageKey); + r->Set(ErrorMessageKey, + TRI_V8_ASCII_STRING("required backend was not available")); + } else if (res.status == CL_COMM_RECEIVED) { // Everything is OK // The headers: v8::Handle h = v8::Object::New(isolate); TRI_GET_GLOBAL_STRING(StatusKey); @@ -1850,6 +1852,9 @@ static void Return_PrepareClusterCommResultForJS( TRI_V8_PAIR_STRING(res.answer->body(), (int)res.answer->bodySize())); } + } else { + TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, + "unknown ClusterComm result status"); } } @@ -1901,7 +1906,7 @@ static void JS_AsyncRequest(v8::FunctionCallbackInfo const& args) { clientTransactionID, coordTransactionID, destination, reqType, path, body, headerFields, 0, timeout, singleRequest); - if (res.invalid) { + if (res.status == CL_COMM_ERROR) { TRI_V8_THROW_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "couldn't queue async request"); }