retdec-cpp
exceptions.h
Go to the documentation of this file.
1 
8 #ifndef RETDEC_EXCEPTIONS_H
9 #define RETDEC_EXCEPTIONS_H
10 
11 #include <stdexcept>
12 #include <string>
13 
14 namespace retdec {
15 
19 class Error: public std::runtime_error {
20 public:
21  Error(const std::string &what);
22 };
23 
27 class IoError: public Error {
28 public:
29  IoError(const std::string &what);
30 };
31 
35 class FilesystemError: public IoError {
36 public:
37  FilesystemError(const std::string &what);
38 };
39 
43 class ConnectionError: public IoError {
44 public:
45  ConnectionError(const std::string &what);
46 };
47 
51 class ApiError: public Error {
52 public:
53  ApiError(int code, const std::string &message,
54  const std::string &description = "");
55 
56  int getCode() const noexcept;
57  std::string getMessage() const;
58  std::string getDescription() const;
59 
60 private:
62  const int code;
63 
65  const std::string message;
66 
68  const std::string description;
69 };
70 
74 class DecompilationError: public Error {
75 public:
76  DecompilationError(const std::string &what);
77 };
78 
79 } // namespace retdec
80 
81 #endif
Exception thrown when there is a filesystem error.
Definition: exceptions.h:35
The namespace of the library.
Definition: doxygen.h:8
DecompilationError(const std::string &what)
Creates an exception.
Definition: exceptions.cpp:76
Exception thrown when there is a connection error.
Definition: exceptions.h:43
IoError(const std::string &what)
Creates an exception.
Definition: exceptions.cpp:21
Error(const std::string &what)
Creates an exception.
Definition: exceptions.cpp:15
ApiError(int code, const std::string &message, const std::string &description="")
Creates an exception.
Definition: exceptions.cpp:43
int getCode() const noexcept
Returns the error code.
Definition: exceptions.cpp:53
std::string getMessage() const
Returns a short message describing the error.
Definition: exceptions.cpp:60
FilesystemError(const std::string &what)
Creates an exception.
Definition: exceptions.cpp:27
Exception thrown when there is an I/O error.
Definition: exceptions.h:27
std::string getDescription() const
Returns a full description of the error (if any).
Definition: exceptions.cpp:69
Exception thrown when a decompilation fails.
Definition: exceptions.h:74
Base class for custom exceptions thrown by the library.
Definition: exceptions.h:19
ConnectionError(const std::string &what)
Creates an exception.
Definition: exceptions.cpp:33
Exception thrown when the API is used incorrectly.
Definition: exceptions.h:51