1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Morgan Deters, Aina Niemetz, Andres Noetzli |
4 |
|
* |
5 |
|
* This file is part of the cvc5 project. |
6 |
|
* |
7 |
|
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS |
8 |
|
* in the top-level source directory and their institutional affiliations. |
9 |
|
* All rights reserved. See the file COPYING in the top-level source |
10 |
|
* directory for licensing information. |
11 |
|
* **************************************************************************** |
12 |
|
* |
13 |
|
* Options-related exceptions. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "cvc5_public.h" |
17 |
|
|
18 |
|
#ifndef CVC5__OPTION_EXCEPTION_H |
19 |
|
#define CVC5__OPTION_EXCEPTION_H |
20 |
|
|
21 |
|
#include "cvc5_export.h" |
22 |
|
#include "base/exception.h" |
23 |
|
|
24 |
|
namespace cvc5 { |
25 |
|
|
26 |
|
/** |
27 |
|
* Class representing an option-parsing exception such as badly-typed |
28 |
|
* or missing arguments, arguments out of bounds, etc. |
29 |
|
*/ |
30 |
6 |
class CVC5_EXPORT OptionException : public cvc5::Exception |
31 |
|
{ |
32 |
|
public: |
33 |
6 |
OptionException(const std::string& s) : cvc5::Exception(s_errPrefix + s) {} |
34 |
|
|
35 |
|
/** |
36 |
|
* Get the error message without the prefix that is automatically added for |
37 |
|
* OptionExceptions. |
38 |
|
*/ |
39 |
|
std::string getRawMessage() const |
40 |
|
{ |
41 |
|
return getMessage().substr(s_errPrefix.size()); |
42 |
|
} |
43 |
|
|
44 |
|
private: |
45 |
|
/** The string to be added in front of the actual error message */ |
46 |
|
static const std::string s_errPrefix; |
47 |
|
}; /* class OptionException */ |
48 |
|
|
49 |
|
} // namespace cvc5 |
50 |
|
|
51 |
|
#endif /* CVC5__OPTION_EXCEPTION_H */ |