A simple scripting language in C++
Ferenc Szontágh
2025-04-19 55abb4f6f81fc370e349385b38dffb05fa9d5dcb
src/Modules/BuiltIn/PrintModule.hpp
@@ -37,6 +37,15 @@
            std::cerr << "\n";
            return Symbols::Value();
        });
        // Built-in error thrower: throws a module exception with provided message
        mgr.registerFunction("throw_error", [](const std::vector<Symbols::Value> & args) {
            if (args.size() != 1 || args[0].getType() != Symbols::Variables::Type::STRING) {
                throw Exception("throw_error requires exactly one string argument");
            }
            std::string msg = args[0].get<std::string>();
            throw Exception(msg);
            return Symbols::Value();  // never reached
        });
    }
};