Commit 1cd8e14d authored by Dominik Charousset's avatar Dominik Charousset

Improve docu and as_string output for exit reasons

parent 52eabba0
...@@ -36,14 +36,12 @@ static constexpr uint32_t not_exited = 0x00000; ...@@ -36,14 +36,12 @@ static constexpr uint32_t not_exited = 0x00000;
static constexpr uint32_t normal = 0x00001; static constexpr uint32_t normal = 0x00001;
/** /**
* Indicates that an actor finished execution * Indicates that an actor finished execution because of an unhandled exception.
* because of an unhandled exception.
*/ */
static constexpr uint32_t unhandled_exception = 0x00002; static constexpr uint32_t unhandled_exception = 0x00002;
/** /**
* Indicates that the actor received an unexpected * Indicates that the actor received an unexpected synchronous reply message.
* synchronous reply message.
*/ */
static constexpr uint32_t unhandled_sync_failure = 0x00004; static constexpr uint32_t unhandled_sync_failure = 0x00004;
...@@ -54,30 +52,30 @@ static constexpr uint32_t unhandled_sync_timeout = 0x00005; ...@@ -54,30 +52,30 @@ static constexpr uint32_t unhandled_sync_timeout = 0x00005;
/** /**
* Indicates that the exit reason for this actor is unknown, i.e., * Indicates that the exit reason for this actor is unknown, i.e.,
* the actor has been terminated and no longer exists. * the actor has been terminated and no longer exists.
*/ */
static constexpr uint32_t unknown = 0x00006; static constexpr uint32_t unknown = 0x00006;
/** /**
* Indicates that the actor was forced to shutdown by * Indicates that the actor was forced to shutdown by a user-generated event.
* a user-generated event.
*/ */
static constexpr uint32_t user_shutdown = 0x00010; static constexpr uint32_t user_shutdown = 0x00010;
/** /**
* Indicates that an actor finishied execution * Indicates that an actor finishied execution because a connection
* because a connection to a remote link was * to a remote link was closed unexpectedly.
* closed unexpectedly.
*/ */
static constexpr uint32_t remote_link_unreachable = 0x00101; static constexpr uint32_t remote_link_unreachable = 0x00101;
/** /**
* Any user defined exit reason should have a * Any user defined exit reason should have a value greater or
* value greater or equal to prevent collisions * equal to prevent collisions with default defined exit reasons.
* with default defined exit reasons.
*/ */
static constexpr uint32_t user_defined = 0x10000; static constexpr uint32_t user_defined = 0x10000;
/**
* Returns a string representation of given exit reason.
*/
const char* as_string(uint32_t value); const char* as_string(uint32_t value);
} // namespace exit_reason } // namespace exit_reason
......
...@@ -29,7 +29,8 @@ constexpr const char* s_names_table[] = { ...@@ -29,7 +29,8 @@ constexpr const char* s_names_table[] = {
"unhandled_exception", "unhandled_exception",
"-invalid-", "-invalid-",
"unhandled_sync_failure", "unhandled_sync_failure",
"unhandled_sync_timeout" "unhandled_sync_timeout",
"unknown"
}; };
} // namespace <anonymous> } // namespace <anonymous>
...@@ -37,13 +38,15 @@ const char* as_string(uint32_t value) { ...@@ -37,13 +38,15 @@ const char* as_string(uint32_t value) {
if (value <= unhandled_sync_timeout) { if (value <= unhandled_sync_timeout) {
return s_names_table[value]; return s_names_table[value];
} }
if (value == remote_link_unreachable) { switch (value) {
return "remote_link_unreachable"; case user_shutdown: return "user_shutdown";
case remote_link_unreachable: return "remote_link_unreachable";
default:
if (value < user_defined) {
return "-invalid-";
}
return "-user defined-";
} }
if (value >= user_defined) {
return "user_defined";
}
return "illegal_exit_reason";
} }
} // namespace exit_reason } // namespace exit_reason
......
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