123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #pragma once
- #include <string>
- #include <system_error>
- namespace rotor {
- enum class error_code_t {
- success = 0,
- cancelled,
- request_timeout,
- supervisor_defined,
- already_registered,
- actor_misconfigured,
- actor_not_linkable,
- already_linked,
- failure_escalation,
- registration_failed,
- discovery_failed,
- unknown_service,
- };
- enum class shutdown_code_t {
- normal = 0,
- supervisor_shutdown,
- child_down,
- child_init_failed,
- init_failed,
- unlink_requested,
- };
- namespace details {
- class error_code_category : public std::error_category {
- public:
-
- virtual const char *name() const noexcept override;
-
- virtual std::string message(int c) const override;
- };
- class shutdown_code_category : public std::error_category {
- public:
-
- virtual const char *name() const noexcept override;
-
- virtual std::string message(int c) const override;
- };
- }
- const details::error_code_category &error_code_category();
- const details::shutdown_code_category &shutdown_code_category();
- inline std::error_code make_error_code(const error_code_t e) { return {static_cast<int>(e), error_code_category()}; }
- inline std::error_code make_error_code(const shutdown_code_t e) {
- return {static_cast<int>(e), shutdown_code_category()};
- }
- }
- namespace std {
- template <> struct is_error_code_enum<rotor::error_code_t> : std::true_type {};
- template <> struct is_error_code_enum<rotor::shutdown_code_t> : std::true_type {};
- }
|