Diag-Client-Lib
dm_error_domain.h
Go to the documentation of this file.
1 /* Diagnostic Client library
2  * Copyright (C) 2024 Avijit Dey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8 #ifndef DIAGNOSTIC_CLIENT_LIB_APPL_SRC_DCM_ERROR_DOMAIN_DM_ERROR_DOMAIN_H
9 #define DIAGNOSTIC_CLIENT_LIB_APPL_SRC_DCM_ERROR_DOMAIN_DM_ERROR_DOMAIN_H
10 
11 #include <string>
12 
15 
16 namespace diag {
17 namespace client {
18 namespace error_domain {
19 
26 };
27 
31 class DmErrorDomain final : public core_type::ErrorDomain {
32  public:
36  using Errc = DmErrorErrc;
37 
41  explicit DmErrorDomain() noexcept;
42 
46  ~DmErrorDomain() noexcept = default;
47 
52  const char *Name() const noexcept override;
53 
60  const char *Message(CodeType error_code) noexcept override;
61 
62  private:
66  const std::string domain_name_{"DcmClientErrorDomain"};
67 
71  std::string message_;
72 };
73 
87 
88 } // namespace error_domain
89 } // namespace client
90 } // namespace diag
91 #endif // DIAGNOSTIC_CLIENT_LIB_APPL_SRC_DCM_ERROR_DOMAIN_DM_ERROR_DOMAIN_H
Encapsulation of an error code. An ErrorCode contains a raw error code value and an error domain....
Definition: error_code.h:22
Encapsulation of an error domain. An error domain is the controlling entity for ErrorCode’s error cod...
Definition: error_domain.h:20
std::int32_t CodeType
Type alias for a domain-specific error code value.
Definition: error_domain.h:30
std::uint8_t SupportDataType
Type alias type for vendor-specific supplementary data.
Definition: error_domain.h:35
Definition of Dcm Client Error domain.
std::string message_
Store the error message.
DmErrorDomain() noexcept
Default constructor.
const char * Name() const noexcept override
Return the name of this error domain.
const std::string domain_name_
Store the error domain name.
const char * Message(CodeType error_code) noexcept override
Return a textual representation of the given error code.
DmErrorErrc
Definition of error code in Dcm Client.
core_type::ErrorCode MakeErrorCode(DmErrorErrc, core_type::ErrorDomain::SupportDataType data) noexcept
Create a new ErrorCode within DmErrorDomain.