Skip to content

Commit 17c114b

Browse files
committed
better string formatting
1 parent 8a9f399 commit 17c114b

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

GitVersionCore/GitHubFlow/BuildNumberCalculator.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,8 @@ void EnsurePullBranchShareACommonAncestorWithMaster(IRepository repository, Bran
6161
return;
6262
}
6363

64-
throw new Exception(
65-
"A pull request branch is expected to branch off of 'master'. "
66-
+ string.Format("However, branch 'master' and '{0}' do not share a common ancestor."
67-
, pullBranch.Name));
64+
var message = string.Format("A pull request branch is expected to branch off of 'master'. However, branch 'master' and '{0}' do not share a common ancestor.", pullBranch.Name);
65+
throw new Exception(message);
6866
}
6967

7068
// TODO refactor to remove duplication
@@ -87,8 +85,8 @@ string ExtractIssueNumber(GitVersionContext context)
8785

8886
if (!LooksLikeAValidPullRequestNumber(issueNumber))
8987
{
90-
throw new ErrorException(string.Format("Unable to extract pull request number from '{0}'.",
91-
pullRequestBranch.CanonicalName));
88+
var message = string.Format("Unable to extract pull request number from '{0}'.", pullRequestBranch.CanonicalName);
89+
throw new ErrorException(message);
9290
}
9391

9492
return issueNumber;

GitVersionCore/SemanticVersion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public string ToString(string format, IFormatProvider formatProvider = null)
227227
return !string.IsNullOrEmpty(buildMetadata) ? string.Format("{0}+{1}", ToString("sp"), buildMetadata) : ToString("sp");
228228
}
229229
default:
230-
throw new ArgumentException("Unrecognised format", "format");
230+
throw new ArgumentException(string.Format("Unrecognised format '{0}'", format), "format");
231231
}
232232
}
233233
}

0 commit comments

Comments
 (0)