/src/rdkit/Code/RDGeneral/BadFileException.h
Line | Count | Source |
1 | | // |
2 | | // Copyright 2003-2006 Greg Landrum and 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_BADFILEEXCEPTION_H |
12 | | #define _RD_BADFILEEXCEPTION_H |
13 | | |
14 | | #include <string> |
15 | | #include <utility> |
16 | | #include <vector> |
17 | | #include <stdexcept> |
18 | | |
19 | | namespace RDKit { |
20 | | |
21 | | //! used by various file parsing classes to indicate a bad file |
22 | | class RDKIT_RDGENERAL_EXPORT BadFileException : public std::runtime_error { |
23 | | public: |
24 | | //! construct with an error message |
25 | | explicit BadFileException(const char *msg) |
26 | 0 | : std::runtime_error("BadFileException"), _msg(msg) {} |
27 | | //! construct with an error message |
28 | | explicit BadFileException(std::string msg) |
29 | 0 | : std::runtime_error("BadFileException"), _msg(std::move(msg)) {} |
30 | | //! get the error message |
31 | 0 | const char *what() const noexcept override { return _msg.c_str(); } |
32 | 0 | ~BadFileException() noexcept override = default; |
33 | | |
34 | | private: |
35 | | std::string _msg; |
36 | | }; |
37 | | } // namespace RDKit |
38 | | |
39 | | #endif |