Errors & Assertions¶
Errors¶
-
enum
JSL::ErrorCode¶ A list of recognised JSL errors.
Values:
-
enumerator
JSLError¶ Global error term.
-
enumerator
SystemError¶ Used when something really went bad, like a failed JSL::systemCall.
-
enumerator
FailedAssertion¶ As the name implies, failed assertions.
-
enumerator
IOError¶ Errors induced by file.
-
enumerator
PlottingError¶ Unique error induced by JSL::gnuplot.
-
enumerator
-
inline void
JSL::Error(ErrorCode code, const std::string &message)¶ An easy way to package throwing errors using the throw command.
- Parameters:
code – One of JSL::ErrorCode to help identify the cause
message – The output message
-
inline void
JSL::Error(const std::string &message)¶ The default version of Error(ErrorCode code, const std::string & message), throwing JSL::JSLError as the identifier code.
- Parameters:
message – The error message passed to the throw command.
Assertions¶
-
template<typename ...
Ts>
inline voidJSL::Assert(std::string assertionMessage, Ts... args)¶ A function which checks that a stated set of conditions are met, and throws a JSL::Error if they are not. Variadic function, and so accepts an arbitrary number of conditions without impact on runtime.
- Parameters:
assertionMessage – The message that gets printed out if the assertion fails. Also useful for internal documentation of code
args – A list of booleans to be checked