From: Kefu Chai Date: Tue, 16 Apr 2019 11:46:40 +0000 (+0800) Subject: crimson/auth: rename auth::auth_error to auth::error X-Git-Tag: v15.1.0~2915^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d87bc2c5d1eebe784604c4fdf7b15839c1706d17;p=ceph.git crimson/auth: rename auth::auth_error to auth::error * s/auth::auth_error/auth::error/: less repeating this way * auth/Errors.{h,cc}: remove them. as we don't need to use error code to construct exceptions in this context * move auth::error into auth::AuthClient Signed-off-by: Kefu Chai --- diff --git a/src/crimson/auth/AuthClient.h b/src/crimson/auth/AuthClient.h index 9d737e079c78..236707b66ea8 100644 --- a/src/crimson/auth/AuthClient.h +++ b/src/crimson/auth/AuthClient.h @@ -10,6 +10,11 @@ class CryptoKey; namespace ceph::auth { +class error : public std::logic_error { +public: + using std::logic_error::logic_error; +}; + // TODO: revisit interfaces for non-dummy implementations class AuthClient { public: diff --git a/src/crimson/auth/Errors.cc b/src/crimson/auth/Errors.cc deleted file mode 100644 index c5f1b8d89f35..000000000000 --- a/src/crimson/auth/Errors.cc +++ /dev/null @@ -1,31 +0,0 @@ -#include "Errors.h" - -namespace ceph::net { - -const std::error_category& auth_category() -{ - struct category : public std::error_category { - const char* name() const noexcept override { - return "ceph::auth"; - } - - std::string message(int ev) const override { - switch (static_cast(ev)) { - case error::success: - return "success", - case error::key_not_found: - return "key not found"; - case error::invalid_key: - return "corrupted key"; - case error::unknown_service: - return "unknown service"; - default: - return "unknown"; - } - } - }; - static category instance; - return instance; -} - -} // namespace ceph::auth diff --git a/src/crimson/auth/Errors.h b/src/crimson/auth/Errors.h deleted file mode 100644 index 92f5c733c2f4..000000000000 --- a/src/crimson/auth/Errors.h +++ /dev/null @@ -1,37 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab - -#pragma once - -namespace ceph::auth { - -enum class error { - success = 0, - key_not_found, - invalid_key, - unknown_service, // no ticket handler for required service -}; - -const std::error_category& auth_category(); - -inline std::error_code make_error_code(error e) -{ - return {static_cast(e), auth_category()}; -} - -inline std::error_condition make_error_condition(error e) -{ - return {static_cast(e), auth_category()}; -} - -class auth_error : public std::runtime_error {}; - -} // namespace ceph::auth - -namespace std { - -/// enables implicit conversion to std::error_condition -template <> -struct is_error_condition_enum : public true_type {}; - -} // namespace std