Added a stringstream object to concatenate strings when building exception message

This commit is contained in:
2026-04-01 23:42:38 +03:00
parent 6f6ea77e69
commit 688f490ec1
+4 -1
View File
@@ -1,6 +1,7 @@
#include "input_resolver.h"
#include <string>
#include <iostream>
#include <sstream>
#define delimiter " "
@@ -63,7 +64,9 @@ Command resolveCommand()
auto validation_result = validate_token(token);
if (!validation_result.ok())
{
throw std::runtime_error{"invalid token " + validation_result.incorrect_token()};
std::ostringstream os;
os << "invalid token "<< validation_result.incorrect_token();
throw std::runtime_error{os.str()};
}
bool shouldQuit = token.find("q") != token.npos;