Correct merge with master

This commit is contained in:
kssenii 2021-09-11 14:56:11 +00:00
parent 6f04e87bc3
commit ec0a43dcd5

View File

@ -98,17 +98,31 @@ void Client::processError(const String & query) const
if (server_exception) if (server_exception)
{ {
bool print_stack_trace = config().getBool("stacktrace", false); bool print_stack_trace = config().getBool("stacktrace", false);
std::cerr << "Received exception from server (version " << server_version << "):" << std::endl fmt::print(stderr, "Received exception from server (version {}):\n{}\n",
<< getExceptionMessage(*server_exception, print_stack_trace, true) << std::endl; server_version,
getExceptionMessage(*server_exception, print_stack_trace, true));
if (is_interactive) if (is_interactive)
std::cerr << std::endl; {
fmt::print(stderr, "\n");
}
else
{
fmt::print(stderr, "(query: {})\n", query);
}
} }
if (client_exception) if (client_exception)
{ {
fmt::print(stderr, "Error on processing query '{}':\n{}\n", query, client_exception->message()); fmt::print(stderr, "Error on processing query: {}\n", client_exception->message());
if (is_interactive) if (is_interactive)
{
fmt::print(stderr, "\n"); fmt::print(stderr, "\n");
}
else
{
fmt::print(stderr, "(query: {})\n", query);
}
} }
// A debug check -- at least some exception must be set, if the error // A debug check -- at least some exception must be set, if the error
@ -301,13 +315,14 @@ bool Client::executeMultiQuery(const String & all_queries_text)
if (!server_exception) if (!server_exception)
{ {
error_matches_hint = false; error_matches_hint = false;
fmt::print(stderr, "Expected server error code '{}' but got no server error.\n", test_hint.serverError()); fmt::print(stderr, "Expected server error code '{}' but got no server error (query: {}).\n",
test_hint.serverError(), full_query);
} }
else if (server_exception->code() != test_hint.serverError()) else if (server_exception->code() != test_hint.serverError())
{ {
error_matches_hint = false; error_matches_hint = false;
std::cerr << "Expected server error code: " << test_hint.serverError() << " but got: " << server_exception->code() fmt::print(stderr, "Expected server error code: {} but got: {} (query: {}).\n",
<< "." << std::endl; test_hint.serverError(), server_exception->code(), full_query);
} }
} }
if (test_hint.clientError()) if (test_hint.clientError())
@ -315,13 +330,14 @@ bool Client::executeMultiQuery(const String & all_queries_text)
if (!client_exception) if (!client_exception)
{ {
error_matches_hint = false; error_matches_hint = false;
fmt::print(stderr, "Expected client error code '{}' but got no client error.\n", test_hint.clientError()); fmt::print(stderr, "Expected client error code '{}' but got no client error (query: {}).\n",
test_hint.clientError(), full_query);
} }
else if (client_exception->code() != test_hint.clientError()) else if (client_exception->code() != test_hint.clientError())
{ {
error_matches_hint = false; error_matches_hint = false;
fmt::print( fmt::print(stderr, "Expected client error code '{}' but got '{}' (query: {}).\n",
stderr, "Expected client error code '{}' but got '{}'.\n", test_hint.clientError(), client_exception->code()); test_hint.clientError(), client_exception->code(), full_query);
} }
} }
if (!test_hint.clientError() && !test_hint.serverError()) if (!test_hint.clientError() && !test_hint.serverError())
@ -336,12 +352,14 @@ bool Client::executeMultiQuery(const String & all_queries_text)
{ {
if (test_hint.clientError()) if (test_hint.clientError())
{ {
fmt::print(stderr, "The query succeeded but the client error '{}' was expected.\n", test_hint.clientError()); fmt::print(stderr, "The query succeeded but the client error '{}' was expected (query: {}).\n",
test_hint.clientError(), full_query);
error_matches_hint = false; error_matches_hint = false;
} }
if (test_hint.serverError()) if (test_hint.serverError())
{ {
fmt::print(stderr, "The query succeeded but the server error '{}' was expected.\n", test_hint.serverError()); fmt::print(stderr, "The query succeeded but the server error '{}' was expected (query: {}).\n",
test_hint.serverError(), full_query);
error_matches_hint = false; error_matches_hint = false;
} }
} }