Skip to content

Commit

Permalink
Fixing failing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jholloc committed Jun 13, 2024
1 parent de5996d commit 0a582a3
Show file tree
Hide file tree
Showing 37 changed files with 1,367 additions and 1,464 deletions.
4 changes: 2 additions & 2 deletions source/client2/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ int uda::client::Client::get(std::string_view data_signal, std::string_view data
UDA_LOG(UDA_LOG_ERROR, "Error identifying the Data Source [{}]", data_source);
add_error(UDA_CODE_ERROR_TYPE, __func__, 999, "Error identifying the Data Source");
}
throw uda::exceptions::ClientError("Error identifying the Data Source [%1%]", data_source);
throw uda::exceptions::ClientError("Error identifying the Data Source [{}]", data_source);
}

print_request_block(request_block);
Expand Down Expand Up @@ -843,7 +843,7 @@ int uda::client::Client::receive_server_block()
add_error(UDA_CODE_ERROR_TYPE, __func__, err, " Protocol 11 Error (Server Block #2)");
// Assuming the server_block is corrupted, replace with a clean copy to avoid future concatonation problems
_server_block.idamerrorstack.nerrors = 0;
throw uda::exceptions::ClientError("Protocol 11 Error (Server Block #2) = %1%", err);
throw uda::exceptions::ClientError("Protocol 11 Error (Server Block #2) = {}", err);
}

UDA_LOG(UDA_LOG_DEBUG, "Server Block Received");
Expand Down
31 changes: 7 additions & 24 deletions source/client2/exceptions.hpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
#pragma once

#ifndef UDA_SOURCE_CLIENT2_EXCEPTIONS_H
# define UDA_SOURCE_CLIENT2_EXCEPTIONS_H
#include <fmt/format.h>
#include <stdexcept>
#include <string>
#include <string_view>

# include <boost/format.hpp>
# include <stdexcept>
# include <string>
# include <string_view>

namespace uda
{
namespace exceptions
namespace uda::exceptions
{

class UDAException : std::exception
Expand All @@ -20,22 +15,13 @@ class UDAException : std::exception

template <class... Args> UDAException(std::string_view msg, Args... args)
{
boost::format formatter{msg.data()};
msg_ = format(formatter, args...);
msg_ = fmt::format(msg, args...);
}

const char* what() const noexcept override { return msg_.c_str(); }

protected:
std::string msg_;

std::string format(boost::format& formatter) { return formatter.str(); }

template <class Arg, class... Args> std::string format(boost::format& formatter, Arg arg, Args... args)
{
formatter = formatter % arg;
return format(formatter, args...);
}
};

class ClientError : UDAException
Expand All @@ -54,7 +40,4 @@ class ServerError : UDAException
template <class... Args> ServerError(std::string_view msg, Args... args) : UDAException(msg, args...) {}
};

} // namespace exceptions
} // namespace uda

#endif // UDA_SOURCE_CLIENT2_EXCEPTIONS_H
} // namespace uda::exceptions
18 changes: 9 additions & 9 deletions source/clientserver/errorLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,29 @@ void uda::client_server::error_log(ClientBlock client_block, RequestBlock reques

struct tm* broken = gmtime(&calendar);

static char accessdate[UDA_DATE_LENGTH]; // The Calendar Time as a formatted String
static char access_date[UDA_DATE_LENGTH]; // The Calendar Time as a formatted String

#ifndef _WIN32
asctime_r(broken, accessdate);
asctime_r(broken, access_date);
#else
asctime_s(accessdate, UDA_DATE_LENGTH, broken);
#endif

convert_non_printable2(accessdate);
trim_string(accessdate);
convert_non_printable2(access_date);
trim_string(access_date);

for (int i = 0; i < request_block.num_requests; ++i) {
auto request = &request_block.requests[i];
log(UDA_LOG_ERROR, __FILE__, __LINE__,
"0 {} [{}] [{} {} {} {} {} {} {} {} {} {} {}]", client_block.uid, accessdate,
request->request, request->signal, request->exp_number, request->pass, request->tpass, request->path,
request->file, request->format, request->archive, request->device_name, request->server);
"0 {} [{}] [{} {} {} {} {} {} {} {} {} {} {}]", client_block.uid, access_date,
request->request, request->signal, request->exp_number, request->pass, request->tpass, request->path,
request->file, request->format, request->archive, request->device_name, request->server);
}

for (unsigned int i = 0; i < nerrors; i++) {
log(UDA_LOG_ERROR, __FILE__, __LINE__,
"1 {} [{}] {} {} [{}] [{}]", client_block.uid, accessdate, errors[i].type,
errors[i].code, errors[i].location, errors[i].msg);
"1 {} [{}] {} {} [{}] [{}]", client_block.uid, access_date, errors[i].type,
errors[i].code, errors[i].location, errors[i].msg);
}
}

Expand Down
7 changes: 5 additions & 2 deletions source/clientserver/makeRequestBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,10 @@ int uda::client_server::make_request_data(const config::Config& config, RequestD

size_t id = 0;
for (const auto& plugin : pluginList) {
if (plugin.name == request->archive) {
std::string name = request->archive;
boost::to_lower(name);
if (plugin.name == name) {

request->request = id;
copy_string(plugin.name, request->format, STRING_LENGTH);
is_function = plugin.type == UDA_PLUGIN_CLASS_FUNCTION;
Expand Down Expand Up @@ -1380,7 +1383,7 @@ int extract_subset(RequestData* request)
std::string operation = signal.substr(lbracket_pos + 1, rbracket_pos - lbracket_pos - 1);
operations.push_front(operation);

std::string subset = signal.substr(lbracket_pos, rbracket_pos - lbracket_pos);
std::string subset = signal.substr(lbracket_pos, rbracket_pos - lbracket_pos + 1);
subsets.push_front(subset);
}

Expand Down
Loading

0 comments on commit 0a582a3

Please sign in to comment.