| 24 | #include <utility> |
| 25 | |
| 26 | class AfError : public std::logic_error { |
| 27 | std::string functionName; |
| 28 | std::string fileName; |
| 29 | boost::stacktrace::stacktrace st_; |
| 30 | int lineNumber; |
| 31 | af_err error; |
| 32 | AfError(); |
| 33 | |
| 34 | public: |
| 35 | AfError(const char* const func, const char* const file, const int line, |
| 36 | const char* const message, af_err err, |
| 37 | boost::stacktrace::stacktrace st); |
| 38 | |
| 39 | AfError(std::string func, std::string file, const int line, |
| 40 | const std::string& message, af_err err, |
| 41 | boost::stacktrace::stacktrace st); |
| 42 | |
| 43 | AfError(const AfError& other) noexcept = delete; |
| 44 | |
| 45 | /// This is the same as default but gcc 6.1 fails when noexcept is used |
| 46 | /// along with the default specifier. Expanded the default definition |
| 47 | /// to avoid this error |
| 48 | AfError(AfError&& other) noexcept |
| 49 | : std::logic_error(std::forward<std::logic_error>(other)) |
| 50 | , functionName(std::forward<std::string>(other.functionName)) |
| 51 | , fileName(std::forward<std::string>(other.fileName)) |
| 52 | , st_(std::forward<boost::stacktrace::stacktrace>(other.st_)) |
| 53 | , lineNumber(std::forward<int>(other.lineNumber)) |
| 54 | , error(std::forward<af_err>(other.error)) {} |
| 55 | |
| 56 | const std::string& getFunctionName() const noexcept; |
| 57 | |
| 58 | const std::string& getFileName() const noexcept; |
| 59 | |
| 60 | const boost::stacktrace::stacktrace& getStacktrace() const noexcept { |
| 61 | return st_; |
| 62 | }; |
| 63 | |
| 64 | int getLine() const noexcept; |
| 65 | |
| 66 | af_err getError() const noexcept; |
| 67 | |
| 68 | virtual ~AfError() noexcept; |
| 69 | }; |
| 70 | |
| 71 | // TODO: Perhaps add a way to return supported types |
| 72 | class TypeError : public AfError { |
nothing calls this directly
no outgoing calls
no test coverage detected