From fd24431eeadad891ab86ae1eefd6a65973e9bd42 Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Fri, 4 Apr 2025 10:55:44 +0000 Subject: [PATCH] feat(kernel/std): implement std::runtime_error and std::length_error Signed-off-by: EnderIce2 --- Kernel/include_std/stdexcept | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Kernel/include_std/stdexcept b/Kernel/include_std/stdexcept index dedee3ee..87030b3c 100644 --- a/Kernel/include_std/stdexcept +++ b/Kernel/include_std/stdexcept @@ -84,6 +84,14 @@ namespace std class runtime_error : public exception { + private: + __simple_string what_arg; + + public: + // runtime_error(const std::string &what_arg); + runtime_error(const char *what_arg) : what_arg(what_arg) {} + runtime_error(const runtime_error &other) : what_arg(other.what_arg) {} + runtime_error &operator=(const runtime_error &other) = default; }; class logic_error : public exception @@ -126,4 +134,13 @@ namespace std invalid_argument(const invalid_argument &other) = default; invalid_argument &operator=(const invalid_argument &other) = default; }; + + class length_error : public logic_error + { + public: + // length_error(const std::string &what_arg); + length_error(const char *what_arg) : logic_error(what_arg) {} + length_error(const length_error &other) : logic_error(other) {} + length_error &operator=(const length_error &other) = default; + }; }