Capsule API Example

Loading...
Searching...
No Matches
InvalidApiException.hpp
Go to the documentation of this file.
1// Copyright. 2019 - 2024 PSBD. All rights reserved.
2
3#pragma once
4
5#include "ClientException.hpp"
6
7#include <string>
8
9 namespace capsule::client {
13 class InvalidApiException final : public ClientException {
14 constexpr static char s_delimiter = '\n';
15 constexpr static std::string_view s_prefix = "Invalid source: ";
16 std::string m_reasonWithSource;
17
18 public:
19 InvalidApiException(std::string_view exceptionReason, std::string_view invalidSource) noexcept
20 : ClientException(exceptionReason) {
21 m_reasonWithSource.append(ClientException::what()).push_back(s_delimiter);
22 m_reasonWithSource.append(s_prefix).append(invalidSource);
23 }
24
25 const char* what() const noexcept override {
26 return m_reasonWithSource.c_str();
27 }
28};
29} // namespace capsule::client
ClientException.hpp
capsule::client::ClientException
Definition ClientException.hpp:12
capsule::client::ClientException::what
const char * what() const noexcept override
Definition ClientException.hpp:21
capsule::client::ClientException::ClientException
ClientException(std::string_view exceptionReason) noexcept
Definition ClientException.hpp:16
capsule::client::InvalidApiException
Definition InvalidApiException.hpp:13
capsule::client::InvalidApiException::what
const char * what() const noexcept override
Definition InvalidApiException.hpp:25
capsule::client::InvalidApiException::InvalidApiException
InvalidApiException(std::string_view exceptionReason, std::string_view invalidSource) noexcept
Definition InvalidApiException.hpp:19
capsule::client
Definition Classification.hpp:7