1 //
2 // Copyright 2003-2006 Rational Discovery LLC
3 //
4 //  @@ All Rights Reserved @@
5 //  This file is part of the RDKit.
6 //  The contents are covered by the terms of the BSD license
7 //  which is included in the file license.txt, found at the root
8 //  of the RDKit source tree.
9 //
10 #include <RDGeneral/export.h>
11 #ifndef RD_FILEPARSEEXCEPTION_H
12 #define RD_FILEPARSEEXCEPTION_H
13 
14 #include <string>
15 #include <stdexcept>
16 
17 namespace RDKit {
18 //! used by various file parsing classes to indicate a parse error
19 class RDKIT_RDGENERAL_EXPORT FileParseException : public std::runtime_error {
20  public:
21   //! construct with an error message
FileParseException(const char * msg)22   explicit FileParseException(const char *msg)
23       : std::runtime_error("FileParseException"), _msg(msg){};
24   //! construct with an error message
FileParseException(const std::string msg)25   explicit FileParseException(const std::string msg)
26       : std::runtime_error("FileParseException"), _msg(msg){};
27   //! get the error message
what()28   const char *what() const noexcept override { return _msg.c_str(); };
~FileParseException()29   ~FileParseException() noexcept {};
30 
31  private:
32   std::string _msg;
33 };
34 }  // namespace RDKit
35 
36 #endif
37