feat(furvm): add stack underflow exception

This commit is contained in:
2026-06-07 12:02:36 +02:00
parent 464b24eeed
commit 48c6da1134
4 changed files with 57 additions and 4 deletions
+43
View File
@@ -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
+7
View File
@@ -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