Added a stringstream object to concatenate strings when building exception message
This commit is contained in:
+4
-1
@@ -1,6 +1,7 @@
|
|||||||
#include "input_resolver.h"
|
#include "input_resolver.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#define delimiter " "
|
#define delimiter " "
|
||||||
|
|
||||||
@@ -63,7 +64,9 @@ Command resolveCommand()
|
|||||||
auto validation_result = validate_token(token);
|
auto validation_result = validate_token(token);
|
||||||
if (!validation_result.ok())
|
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;
|
bool shouldQuit = token.find("q") != token.npos;
|
||||||
|
|||||||
Reference in New Issue
Block a user