Skip to content
Snippets Groups Projects
Commit b313a501 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Remove useless RuntimeError class

parent d7eca925
No related branches found
No related tags found
1 merge request!37Feature/language
......@@ -5,7 +5,7 @@
#include <language/node_processor/FunctionArgumentConverter.hpp>
#include <language/node_processor/INodeProcessor.hpp>
#include <language/utils/BuiltinFunctionEmbedder.hpp>
#include <language/utils/RuntimeError.hpp>
#include <utils/Exceptions.hpp>
class BuiltinFunctionExpressionProcessor final : public INodeProcessor
{
......@@ -63,8 +63,8 @@ class BuiltinFunctionProcessor : public INodeProcessor
try {
return m_function_expression_processor->execute(context_exec_policy);
}
catch (RuntimeError& e) {
throw parse_error(e.message(), {m_argument_node.begin()});
catch (NormalError& e) {
throw parse_error(e.what(), {m_argument_node.begin()});
}
}
......
......@@ -5,7 +5,6 @@
#include <language/ast/ASTNodeDataType.hpp>
#include <language/node_processor/ExecutionPolicy.hpp>
#include <language/utils/ASTNodeDataTypeTraits.hpp>
#include <language/utils/RuntimeError.hpp>
#include <language/utils/SymbolTable.hpp>
#include <utils/Array.hpp>
#include <utils/Exceptions.hpp>
......@@ -158,7 +157,7 @@ class PugsFunctionAdapter<OutputType(InputType...)>
<< rang::style::reset << '\n'
<< "note: provided function " << rang::fgB::magenta << function.name() << ": "
<< function.domainMappingNode().string() << rang::style::reset << std::ends;
throw RuntimeError(error_message.str());
throw NormalError(error_message.str());
}
return flatten_list;
......
#ifndef RUNTIME_ERROR_HPP
#define RUNTIME_ERROR_HPP
#include <string>
class RuntimeError
{
private:
std::string m_message;
public:
const std::string&
message() const
{
return m_message;
}
RuntimeError(const std::string& message) : m_message{message} {}
RuntimeError() = delete;
RuntimeError(const RuntimeError&) = delete;
RuntimeError(RuntimeError&&) = delete;
~RuntimeError() = default;
};
#endif // RUNTIME_ERROR_HPP
......@@ -70,7 +70,6 @@ add_executable (unit_tests
test_PCG.cpp
test_PugsAssert.cpp
test_RevisionInfo.cpp
test_RuntimeError.cpp
test_SparseMatrixDescriptor.cpp
test_SymbolTable.cpp
test_TinyMatrix.cpp
......
#include <catch2/catch.hpp>
#include <language/utils/RuntimeError.hpp>
// clazy:excludeall=non-pod-global-static
TEST_CASE("RuntimeError", "[language]")
{
RuntimeError e{"error message"};
REQUIRE(e.message() == "error message");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment