KiCad PCB EDA Suite
sexpr_exception.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 Mark Roszko <[email protected]>
3 * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef SEXPR_EXCEPTION_H_
20#define SEXPR_EXCEPTION_H_
21
22#include <exception>
23#include <string>
24
25namespace SEXPR
26{
27 class PARSE_EXCEPTION : public std::exception
28 {
29 public:
30 PARSE_EXCEPTION( const std::string& aMessage ) : msg( aMessage ) {}
31 const char* what() const noexcept override { return msg.c_str(); }
32 virtual ~PARSE_EXCEPTION() noexcept {}
33
34 private:
35 std::string msg;
36 };
37
38 class INVALID_TYPE_EXCEPTION : public std::exception
39 {
40 public:
41 INVALID_TYPE_EXCEPTION( const std::string& aMessage ) : msg( aMessage ) {}
42 const char* what() const noexcept override { return msg.c_str(); }
43 virtual ~INVALID_TYPE_EXCEPTION() noexcept {}
44
45 private:
46 std::string msg;
47 };
48}
49#endif
const char * what() const noexcept override
virtual ~INVALID_TYPE_EXCEPTION() noexcept
INVALID_TYPE_EXCEPTION(const std::string &aMessage)
const char * what() const noexcept override
virtual ~PARSE_EXCEPTION() noexcept
PARSE_EXCEPTION(const std::string &aMessage)