aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/salticidae/util.h4
-rw-r--r--src/util.cpp11
2 files changed, 7 insertions, 8 deletions
diff --git a/include/salticidae/util.h b/include/salticidae/util.h
index e51f984..05e7b66 100644
--- a/include/salticidae/util.h
+++ b/include/salticidae/util.h
@@ -48,7 +48,9 @@ class SalticidaeError: public std::exception {
public:
SalticidaeError();
SalticidaeError(const std::string &fmt, ...);
- operator std::string() const;
+
+ operator std::string() const { return msg; }
+ const char *what() const throw() override { return msg.c_str(); }
};
class Logger {
diff --git a/src/util.cpp b/src/util.cpp
index 19ec01c..a1086f8 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -80,10 +80,6 @@ SalticidaeError::SalticidaeError(const std::string &fmt, ...) {
}
}
-SalticidaeError::operator std::string() const {
- return msg;
-}
-
void Logger::write(const char *tag, const char *fmt, va_list ap) {
fprintf(output, "%s [%s %s] ", get_current_datetime().c_str(), prefix, tag);
vfprintf(output, fmt, ap);
@@ -223,10 +219,11 @@ size_t Config::parse(int argc, char **argv) {
update(*getopt_order[id], optarg);
if (id == conf_idx)
{
- if (load(conf_fname))
- SALTICIDAE_LOG_INFO("load configuration from %s", conf_fname.c_str());
+ auto &fname = opt_val_conf.get();
+ if (load(fname))
+ SALTICIDAE_LOG_INFO("loading extra configuration from %s", fname.c_str());
else
- SALTICIDAE_LOG_INFO("configuration file %s not found", conf_fname.c_str());
+ SALTICIDAE_LOG_INFO("configuration file %s not found", fname.c_str());
}
}
return optind;