Keypop Calypso Crypto Symmetric C++ API - 0.1.1
Component of the Keypop C++ API
SymmetricCryptoIOException.hpp
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) 2025 Calypso Networks Association https://calypsonet.org/ *
3 * *
4 * This program and the accompanying materials are made available under the *
5 * terms of the MIT License which is available at *
6 * https://opensource.org/licenses/MIT. *
7 * *
8 * SPDX-License-Identifier: MIT *
9 ******************************************************************************/
10
11#pragma once
12
13#include <memory>
14#include <stdexcept>
15#include <string>
16
17namespace keypop {
18namespace calypso {
19namespace crypto {
20namespace symmetric {
21
27class SymmetricCryptoIOException final : public std::exception {
28public:
33 explicit SymmetricCryptoIOException(const std::string& message)
34 : mMessage(message)
35 {
36 }
37
46 const std::string& message, const std::exception& cause)
47 : mMessage(message)
48 , mCause(cause.what() != nullptr ? cause.what() : "")
49 {
50 }
51
56 const char*
57 what() const noexcept override
58 {
59 return mMessage.c_str();
60 }
61
65 const std::string&
66 getCause() const noexcept
67 {
68 return mCause;
69 }
70
71private:
72 std::string mMessage;
73 std::string mCause;
74};
75
76} /* namespace symmetric */
77} /* namespace crypto */
78} /* namespace calypso */
79} /* namespace keypop */
Indicates that an IO error occurred when processing a command.
const char * what() const noexcept override
Returns the detail message, so that what() reports it instead of the default "Unknown exception" of s...
const std::string & getCause() const noexcept
Returns the message of the underlying cause, empty if none.
SymmetricCryptoIOException(const std::string &message, const std::exception &cause)
Encapsulates a lower level exception.