feat(furvm): add stack underflow exception
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#ifndef FURVM_EXCEPTIONS_HPP
|
||||
#define FURVM_EXCEPTIONS_HPP
|
||||
|
||||
#include <exception>
|
||||
|
||||
namespace furvm {
|
||||
|
||||
class stack_underflow : public std::exception {
|
||||
public:
|
||||
stack_underflow() = default;
|
||||
~stack_underflow() override = default;
|
||||
|
||||
/**
|
||||
* @brief Move constructor.
|
||||
*/
|
||||
stack_underflow(stack_underflow&&) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Move constructor.
|
||||
*/
|
||||
stack_underflow& operator=(stack_underflow&&) noexcept = default;
|
||||
|
||||
/**
|
||||
* @brief Copy constructor.
|
||||
*/
|
||||
stack_underflow(const stack_underflow&) = default;
|
||||
|
||||
/**
|
||||
* @brief Copy constructor.
|
||||
*/
|
||||
stack_underflow& operator=(const stack_underflow&) = default;
|
||||
public:
|
||||
/**
|
||||
* @brief Returns a C-style string describing the cause of the error.
|
||||
*
|
||||
* @return The cause of the error.
|
||||
*/
|
||||
const char* what() const noexcept override { return "stack underflow"; }
|
||||
};
|
||||
|
||||
} // namespace furvm
|
||||
|
||||
#endif // FURVM_EXCEPTIONS_HPP
|
||||
@@ -140,6 +140,13 @@ class context;
|
||||
*/
|
||||
using context_p = std::shared_ptr<context>;
|
||||
|
||||
// exceptions.hpp:
|
||||
|
||||
/**
|
||||
* @brief Stack underflow exception.
|
||||
*/
|
||||
class stack_underflow;
|
||||
|
||||
} // namespace furvm
|
||||
|
||||
#endif // FURVM_FWD_HPP
|
||||
Reference in New Issue
Block a user