Skip to content

Commit

Permalink
Message for exception
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Nov 6, 2024
1 parent 6956bef commit 5579806
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/solver/modelConverter/convertorVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,18 @@ std::any ConvertorVisitor::visit(antlr4::tree::ParseTree* tree)
class NoParameterOrVariableWithThisName: public std::exception
{
public:
NoParameterOrVariableWithThisName(std::string id):
id_(id)
{
}

const char* what() const noexcept override
{
return "No parameter or variable found for this identifier";
return ("No parameter or variable found for this identifier: " + id_).c_str();
}

private:
std::string id_ = "";
};

std::any ConvertorVisitor::visitIdentifier(ExprParser::IdentifierContext* context)
Expand All @@ -98,7 +106,7 @@ std::any ConvertorVisitor::visitIdentifier(ExprParser::IdentifierContext* contex
}

logs.error() << "No parameter or variable found with this name: " << context->getText();
throw NoParameterOrVariableWithThisName();
throw NoParameterOrVariableWithThisName(context->getText());
}

std::any ConvertorVisitor::visitMuldiv(ExprParser::MuldivContext* context)
Expand Down

0 comments on commit 5579806

Please sign in to comment.