| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | #ifndef SCRIPTEXCEPTION_H |
| 4 | #define SCRIPTEXCEPTION_H |
| 5 | |
| 6 | #include "exceptions/applicationexception.h" |
| 7 | |
| 8 | #include <QCoreApplication> |
| 9 | |
| 10 | class RSSGUARD_DLLSPEC ScriptException : public ApplicationException { |
| 11 | Q_DECLARE_TR_FUNCTIONS(ScriptException) |
| 12 | |
| 13 | public: |
| 14 | enum class Reason { |
| 15 | ExecutionLineInvalid, |
| 16 | InterpreterNotFound, |
| 17 | InterpreterError, |
| 18 | InterpreterTimeout, |
| 19 | OtherError |
| 20 | }; |
| 21 | |
| 22 | explicit ScriptException(Reason reason = Reason::OtherError, const QString& message = QString()); |
| 23 | |
| 24 | Reason reason() const; |
| 25 | |
| 26 | private: |
| 27 | QString messageForReason(Reason reason) const; |
| 28 | |
| 29 | private: |
| 30 | Reason m_reason; |
| 31 | }; |
| 32 | |
| 33 | #endif // SCRIPTEXCEPTION_H |