Path: blob/main/contrib/kyua/utils/config/exceptions.hpp
48081 views
// Copyright 2012 The Kyua Authors.1// All rights reserved.2//3// Redistribution and use in source and binary forms, with or without4// modification, are permitted provided that the following conditions are5// met:6//7// * Redistributions of source code must retain the above copyright8// notice, this list of conditions and the following disclaimer.9// * Redistributions in binary form must reproduce the above copyright10// notice, this list of conditions and the following disclaimer in the11// documentation and/or other materials provided with the distribution.12// * Neither the name of Google Inc. nor the names of its contributors13// may be used to endorse or promote products derived from this software14// without specific prior written permission.15//16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.2728/// \file utils/config/exceptions.hpp29/// Exception types raised by the config module.3031#if !defined(UTILS_CONFIG_EXCEPTIONS_HPP)32#define UTILS_CONFIG_EXCEPTIONS_HPP3334#include <stdexcept>3536#include "utils/config/keys_fwd.hpp"37#include "utils/config/tree_fwd.hpp"3839namespace utils {40namespace config {414243/// Base exceptions for config errors.44class error : public std::runtime_error {45public:46explicit error(const std::string&);47~error(void) throw();48};495051/// Exception denoting that two trees cannot be combined.52class bad_combination_error : public error {53public:54explicit bad_combination_error(const detail::tree_key&,55const std::string&);56~bad_combination_error(void) throw();57};585960/// Exception denoting that a key was not found within a tree.61class invalid_key_error : public error {62public:63explicit invalid_key_error(const std::string&);64~invalid_key_error(void) throw();65};666768/// Exception denoting that a key was given an invalid value.69class invalid_key_value : public error {70public:71explicit invalid_key_value(const detail::tree_key&, const std::string&);72~invalid_key_value(void) throw();73};747576/// Exception denoting that a configuration file is invalid.77class syntax_error : public error {78public:79explicit syntax_error(const std::string&);80~syntax_error(void) throw();81};828384/// Exception denoting that a key was not found within a tree.85class unknown_key_error : public error {86public:87explicit unknown_key_error(const detail::tree_key&,88const std::string& = "");89~unknown_key_error(void) throw();90};919293/// Exception denoting that a value was invalid.94class value_error : public error {95public:96explicit value_error(const std::string&);97~value_error(void) throw();98};99100101} // namespace config102} // namespace utils103104105#endif // !defined(UTILS_CONFIG_EXCEPTIONS_HPP)106107108