Commit 0c5ed145 authored by Dominik Charousset's avatar Dominik Charousset

Merge pull request #1021

parents 75b75015 333c5256
...@@ -431,7 +431,8 @@ timespan actor_system_config::stream_tick_duration() const noexcept { ...@@ -431,7 +431,8 @@ timespan actor_system_config::stream_tick_duration() const noexcept {
return timespan{ns_count}; return timespan{ns_count};
} }
std::string actor_system_config::render(const error& err) { std::string actor_system_config::render(const error& err) {
std::string msg; if (!err)
return "none";
switch (static_cast<uint64_t>(err.category())) { switch (static_cast<uint64_t>(err.category())) {
case atom_uint("system"): case atom_uint("system"):
return render_sec(err.code(), err.category(), err.context()); return render_sec(err.code(), err.category(), err.context());
...@@ -439,8 +440,11 @@ std::string actor_system_config::render(const error& err) { ...@@ -439,8 +440,11 @@ std::string actor_system_config::render(const error& err) {
return render_exit_reason(err.code(), err.category(), err.context()); return render_exit_reason(err.code(), err.category(), err.context());
case atom_uint("parser"): case atom_uint("parser"):
return render_pec(err.code(), err.category(), err.context()); return render_pec(err.code(), err.category(), err.context());
default:
return deep_to_string(meta::type_name("error"), err.code(),
err.category(), meta::omittable_if_empty(),
err.context());
} }
return "unknown-error";
} }
std::string actor_system_config::render_sec(uint8_t x, atom_value, std::string actor_system_config::render_sec(uint8_t x, atom_value,
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "caf/error.hpp" #include "caf/error.hpp"
#include "caf/actor_system_config.hpp"
#include "caf/config.hpp" #include "caf/config.hpp"
#include "caf/deep_to_string.hpp" #include "caf/deep_to_string.hpp"
#include "caf/deserializer.hpp" #include "caf/deserializer.hpp"
...@@ -166,10 +167,7 @@ error error::apply(const inspect_fun& f) { ...@@ -166,10 +167,7 @@ error error::apply(const inspect_fun& f) {
} }
std::string to_string(const error& x) { std::string to_string(const error& x) {
if (!x) return actor_system_config::render(x);
return "none";
return deep_to_string(meta::type_name("error"), x.code(), x.category(),
meta::omittable_if_empty(), x.context());
} }
} // namespace caf } // namespace caf
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment