Horizon
sexpr_exception.h
1 /*
2  * Copyright (C) 2016 Mark Roszko <mark.roszko@gmail.com>
3  * Copyright (C) 2017 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 
25 namespace 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  private:
34  std::string msg;
35  };
36 
37  class INVALID_TYPE_EXCEPTION : public std::exception
38  {
39  public:
40  INVALID_TYPE_EXCEPTION( const std::string aMessage ) : msg( aMessage ) {}
41  const char* what() const noexcept override { return msg.c_str(); }
42  virtual ~INVALID_TYPE_EXCEPTION() noexcept {}
43  private:
44  std::string msg;
45  };
46 }
47 #endif