Better error messages when parsing version information fails
This commit is contained in:
parent
4069358b31
commit
f5305aa95d
@ -76,12 +76,12 @@ namespace gitversion {
|
||||
string commitsSinceTag;
|
||||
getline(stream, commitsSinceTag, '.');
|
||||
if (!stream.good()) {
|
||||
throw std::logic_error("Invalid version information: Missing delimiter after commitsSinceTag.");
|
||||
throw std::logic_error("Invalid version information: Missing delimiter after commitsSinceTag (versionInfo: "+versionInfo+").");
|
||||
}
|
||||
string gitCommitId;
|
||||
getline(stream, gitCommitId, '.');
|
||||
if (gitCommitId[0] != 'g') {
|
||||
throw std::logic_error("Invalid version information: Git commit id component doesn't start with 'g'.");
|
||||
throw std::logic_error("Invalid version information: Git commit id component doesn't start with 'g' (versionInfo: "+versionInfo+").");
|
||||
}
|
||||
return std::make_tuple(gitCommitId.substr(1), std::stoul(commitsSinceTag));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user