8000 throw parse error if we fail to parse the json document by dothebart · Pull Request #10226 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

throw parse error if we fail to parse the json document #10226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 11, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
throw parse error if we fail to parse the json document
  • Loading branch information
dothebart committed Oct 10, 2019
commit 6456c0a8ef54524403d7cac0626594b4d5b80ffc
10 changes: 9 additions & 1 deletion arangosh/Shell/V8ClientConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,15 @@ v8::Local<v8::Value> V8ClientConnection::handleResult(v8::Isolate* isolate,
char const* str = reinterpret_cast<char const*>(sb.data());

if (res->isContentTypeJSON()) {
return TRI_FromJsonString(isolate, str, sb.size(), nullptr);
char *error = nullptr;
v8::Local<v8::Value> ret = TRI_FromJsonString(isolate, str, sb.size(), &error);
if (error != nullptr) {
std::string err("Error parsing the server JSON reply: ");
err += error;
free(error);
TRI_CreateErrorObject(isolate, TRI_ERROR_HTTP_CORRUPTED_JSON, err, true);
}
return ret;
}
// return body as string
return TRI_V8_PAIR_STRING(isolate, str, sb.size());
Expand Down
0