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;
|
string commitsSinceTag;
|
||||||
getline(stream, commitsSinceTag, '.');
|
getline(stream, commitsSinceTag, '.');
|
||||||
if (!stream.good()) {
|
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;
|
string gitCommitId;
|
||||||
getline(stream, gitCommitId, '.');
|
getline(stream, gitCommitId, '.');
|
||||||
if (gitCommitId[0] != 'g') {
|
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));
|
return std::make_tuple(gitCommitId.substr(1), std::stoul(commitsSinceTag));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user