CASM  1.1.0
A Clusters Approach to Statistical Mechanics
errors.hh
Go to the documentation of this file.
1 #ifndef CASM_app_errors
2 #define CASM_app_errors
3 
4 #include <string>
5 
6 // Command line input is not valid
7 #define ERR_INVALID_ARG 1
8 
9 // Misc. or Unknown error
10 #define ERR_UNKNOWN 2
11 
12 // No CASM project can be found in expected location
13 #define ERR_NO_PROJ 3
14 
15 // An expected input file is invalid
16 #define ERR_INVALID_INPUT_FILE 4
17 
18 // An expected input file can not be found
19 #define ERR_MISSING_INPUT_FILE 5
20 
21 // A file might be overwritten
22 #define ERR_EXISTING_FILE 6
23 
24 // Requested command can not be performed because some dependency needs to be
25 // done first (i.e. no basis set, so can't use clexulator)
26 #define ERR_MISSING_DEPENDS 7
27 
28 // Unknown attempting to overwrite another CASM project
29 #define ERR_OTHER_PROJ 8
30 
32 namespace CASM {
33 
34 class runtime_error : public std::runtime_error {
35  public:
36  runtime_error(std::string _what, int _code = ERR_UNKNOWN)
37  : std::runtime_error(_what), m_code(_code) {}
38 
39  virtual ~runtime_error() {}
40 
41  int code() const { return m_code; }
42 
43  private:
44  int m_code;
45 };
46 
47 } // namespace CASM
48 
49 #endif
#define ERR_UNKNOWN
Definition: errors.hh:10
int code() const
Definition: errors.hh:41
virtual ~runtime_error()
Definition: errors.hh:39
runtime_error(std::string _what, int _code=ERR_UNKNOWN)
Definition: errors.hh:36
Main CASM namespace.
Definition: APICommand.hh:8
Definition: stream_io.hh:24