network-experiment/bmrshared/include/bmrshared/ToTupleException.hpp

46 lines
1.3 KiB
C++

// GNU Lesser General Public License v3.0
// Copyright (c) 2023 Bart Beumer <bart@4beumer.nl>
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License v3.0 as published by
// the Free Software Foundation.
//
#pragma once
#include <exception>
#include <string>
#include <vector>
namespace bmrshared
{
class ToTupleException : public std::exception
{
public:
struct ParamError
{
std::string name;
std::string type;
};
ToTupleException(std::vector<std::string> keysMissing,
std::vector<std::string> keysNotUsed,
std::vector<ParamError> paramErrors);
~ToTupleException() override;
const std::vector<std::string>& GetKeysMissing() const;
const std::vector<std::string>& GetKeysNotUsed() const;
const char* what() const noexcept override;
private:
static std::string GenerateWhat(const std::vector<std::string>& keysMissing,
const std::vector<std::string>& keysNotUsed,
const std::vector<ParamError>& paramErrors);
private:
std::vector<std::string> m_keysMissing;
std::vector<std::string> m_keysNotUsed;
std::vector<ParamError> m_paramErrors;
std::string m_what;
};
} // namespace bmrshared