Skip to content

Commit 53945c5

Browse files
committed
Errors should be warnings
1 parent 6944d02 commit 53945c5

31 files changed

+70
-69
lines changed

GitVersionCore/ArgumentParser.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ public static Arguments ParseArguments(List<string> commandLineArguments)
147147
OutputType outputType;
148148
if (!Enum.TryParse(value, true, out outputType))
149149
{
150-
throw new ErrorException(string.Format("Value '{0}' cannot be parsed as output type, please use 'json' or 'buildserver'", value));
150+
throw new WarningException(string.Format("Value '{0}' cannot be parsed as output type, please use 'json' or 'buildserver'", value));
151151
}
152152

153153
arguments.Output = outputType;
154154
continue;
155155
}
156156

157-
throw new ErrorException(string.Format("Could not parse command line parameter '{0}'.", name));
157+
throw new WarningException(string.Format("Could not parse command line parameter '{0}'.", name));
158158
}
159159
return arguments;
160160
}

GitVersionCore/BuildServers/AppVeyor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public override void PerformPreProcessingSteps(string gitDirectory)
2222
{
2323
if (string.IsNullOrEmpty(gitDirectory))
2424
{
25-
throw new ErrorException("Failed to find .git directory on agent. Please make sure agent checkout mode is enabled for you VCS roots - http://confluence.jetbrains.com/display/TCD8/VCS+Checkout+Mode");
25+
throw new WarningException("Failed to find .git directory on agent. Please make sure agent checkout mode is enabled for you VCS roots - http://confluence.jetbrains.com/display/TCD8/VCS+Checkout+Mode");
2626
}
2727

2828
var repoBranch = Environment.GetEnvironmentVariable("APPVEYOR_REPO_BRANCH");

GitVersionCore/BuildServers/ContinuaCi.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public override void PerformPreProcessingSteps(string gitDirectory)
3232
{
3333
if (string.IsNullOrEmpty(gitDirectory))
3434
{
35-
throw new ErrorException("Failed to find .git directory on agent");
35+
throw new WarningException("Failed to find .git directory on agent");
3636
}
3737

3838
GitHelper.NormalizeGitDirectory(gitDirectory, arguments);

GitVersionCore/BuildServers/GitHelper.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,14 @@ static void CreateFakeBranchPointingAtThePullRequestTip(Repository repo, Argumen
8686
if (refs.Count == 0)
8787
{
8888
var message = string.Format("Couldn't find any remote tips from remote '{0}' pointing at the commit '{1}'.", remote.Url, headTipSha);
89-
throw new ErrorException(message);
89+
throw new WarningException(message);
9090
}
9191

9292
if (refs.Count > 1)
9393
{
9494
var names = string.Join(", ", refs.Select(r => r.CanonicalName));
9595
var message = string.Format("Found more than one remote tip from remote '{0}' pointing at the commit '{1}'. Unable to determine which one to use ({2}).", remote.Url, headTipSha, names);
96-
throw new ErrorException(message);
96+
throw new WarningException(message);
9797
}
9898

9999
var canonicalName = refs[0].CanonicalName;
@@ -102,7 +102,7 @@ static void CreateFakeBranchPointingAtThePullRequestTip(Repository repo, Argumen
102102
if (!canonicalName.StartsWith("refs/pull/"))
103103
{
104104
var message = string.Format("Remote tip '{0}' from remote '{1}' doesn't look like a valid pull request.", canonicalName, remote.Url);
105-
throw new ErrorException(message);
105+
throw new WarningException(message);
106106
}
107107

108108
var fakeBranchName = canonicalName.Replace("refs/pull/", "refs/heads/pull/");
@@ -168,7 +168,7 @@ static Remote EnsureOnlyOneRemoteIsDefined(IRepository repo)
168168
}
169169

170170
var message = string.Format("{0} remote(s) have been detected. When being run on a TeamCity agent, the Git repository is expected to bear one (and no more than one) remote.", howMany);
171-
throw new ErrorException(message);
171+
throw new WarningException(message);
172172
}
173173
}
174174
}

GitVersionCore/BuildServers/TeamCity.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public override void PerformPreProcessingSteps(string gitDirectory)
2020
{
2121
if (string.IsNullOrEmpty(gitDirectory))
2222
{
23-
throw new ErrorException("Failed to find .git directory on agent. Please make sure agent checkout mode is enabled for you VCS roots - http://confluence.jetbrains.com/display/TCD8/VCS+Checkout+Mode");
23+
throw new WarningException("Failed to find .git directory on agent. Please make sure agent checkout mode is enabled for you VCS roots - http://confluence.jetbrains.com/display/TCD8/VCS+Checkout+Mode");
2424
}
2525

2626
GitHelper.NormalizeGitDirectory(gitDirectory, arguments);

GitVersionCore/GitFlow/BranchFinders/DevelopBasedVersionFinderBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Commit FindCommonAncestorWithDevelop(IRepository repo, Branch branch, BranchType
6565
return ancestor;
6666
}
6767

68-
throw new ErrorException(
68+
throw new WarningException(
6969
string.Format("A {0} branch is expected to branch off of 'develop'. "
7070
+ "However, branch 'develop' and '{1}' do not share a common ancestor."
7171
, branchType, branch.Name));

GitVersionCore/GitFlow/BranchFinders/MasterVersionFinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public SemanticVersion FindVersion(IRepository repository, Commit tip)
2626
}
2727
}
2828

29-
throw new ErrorException("The head of master should always be a merge commit if you follow gitflow. Please create one or work around this by tagging the commit with SemVer compatible Id.");
29+
throw new WarningException("The head of master should always be a merge commit if you follow gitflow. Please create one or work around this by tagging the commit with SemVer compatible Id.");
3030
}
3131

3232
SemanticVersion BuildVersion(IRepository repository, Commit tip, int major, int minor, int patch)

GitVersionCore/GitFlow/BranchFinders/OptionallyTaggedBranchVersionFinderBase.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,23 +105,23 @@ void EnsureVersionIsValid(SemanticVersion version, Branch branch, BranchType bra
105105

106106
if (version.PreReleaseTag.HasTag())
107107
{
108-
throw new ErrorException(msg + string.Format("Supported format is '{0}-Major.Minor.Patch'.", branchType.ToString().ToLowerInvariant()));
108+
throw new WarningException(msg + string.Format("Supported format is '{0}-Major.Minor.Patch'.", branchType.ToString().ToLowerInvariant()));
109109
}
110110

111111
switch (branchType)
112112
{
113113
case BranchType.Hotfix:
114114
if (version.Patch == 0)
115115
{
116-
throw new ErrorException(msg + "A patch segment different than zero is required.");
116+
throw new WarningException(msg + "A patch segment different than zero is required.");
117117
}
118118

119119
break;
120120

121121
case BranchType.Release:
122122
if (version.Patch != 0)
123123
{
124-
throw new ErrorException(msg + "A patch segment equals to zero is required.");
124+
throw new WarningException(msg + "A patch segment equals to zero is required.");
125125
}
126126

127127
break;
@@ -154,7 +154,7 @@ int NumberOfCommitsInBranchNotKnownFromBaseBranch(
154154
if (ancestor == null)
155155
{
156156
var message = string.Format("A {0} branch is expected to branch off of '{1}'. However, branch '{1}' and '{2}' do not share a common ancestor.", branchType, baseBranchName, branch.Name);
157-
throw new ErrorException(message);
157+
throw new WarningException(message);
158158
}
159159

160160
var filter = new CommitFilter

GitVersionCore/GitFlow/BranchFinders/PullVersionFinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ string ExtractIssueNumber(GitVersionContext context)
3131

3232
if (!LooksLikeAValidPullRequestNumber(issueNumber))
3333
{
34-
throw new ErrorException(string.Format("Unable to extract pull request number from '{0}'.",
34+
throw new WarningException(string.Format("Unable to extract pull request number from '{0}'.",
3535
pullRequestBranch.CanonicalName));
3636
}
3737

GitVersionCore/GitFlow/BranchFinders/SupportVersionFinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public SemanticVersion FindVersion(IRepository repository, Commit tip)
2626
}
2727
}
2828

29-
throw new ErrorException("The head of a support branch should always be a merge commit if you follow gitflow. Please create one or work around this by tagging the commit with SemVer compatible Id.");
29+
throw new WarningException("The head of a support branch should always be a merge commit if you follow gitflow. Please create one or work around this by tagging the commit with SemVer compatible Id.");
3030
}
3131

3232
SemanticVersion BuildVersion(IRepository repository, Commit tip, int major, int minor, int patch)

0 commit comments

Comments
 (0)