Diag-Client-Lib
doip_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 DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_ERROR_DOMAIN_DOIP_ERROR_DOMAIN_H_
9 #define DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_ERROR_DOMAIN_DOIP_ERROR_DOMAIN_H_
10 
11 #include <string>
12 
15 
16 namespace doip_client {
17 namespace error_domain {
18 
25  kSocketError = 2U,
26  kGenericError = 3U
27 };
28 
33  public:
38 
42  explicit DoipErrorDomain() noexcept;
43 
47  ~DoipErrorDomain() noexcept override = default;
48 
53  const char *Name() const noexcept override;
54 
61  const char *Message(CodeType error_code) noexcept override;
62 
63  private:
67  const std::string domain_name_{"DoipClientErrorDomain"};
68 
72  std::string message_;
73 };
74 
88 
89 } // namespace error_domain
90 } // namespace doip_client
91 #endif // DIAG_CLIENT_LIB_LIB_DOIP_CLIENT_ERROR_DOMAIN_DOIP_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 Doip Client Error domain.
std::string message_
Store the error message.
DoipErrorDomain() noexcept
Default constructor.
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.
const char * Name() const noexcept override
Return the name of this error domain.
core_type::ErrorCode MakeErrorCode(DoipErrorErrc, core_type::ErrorDomain::SupportDataType data) noexcept
Create a new ErrorCode within DoipErrorDomain.
DoipErrorErrc
Definition of error code in Doip Client.