Skip to content

Commit 8c08153

Browse files
author
Klein Hu
committed
Print version number in exception handing.
1 parent 56331e9 commit 8c08153

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/ResourceManager/MachineLearning/Commands.MachineLearning/Cmdlets/ExportWebServiceDefinition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class ExportWebServiceDefinition : WebServicesCmdletBase
6060
HelpMessage = "Do not ask for confirmation.")]
6161
public SwitchParameter Force { get; set; }
6262

63-
public override void ExecuteCmdlet()
63+
protected override void RunCmdlet()
6464
{
6565
string serializedDefinition =
6666
ModelsSerializationUtil.GetAzureMLWebServiceDefinitionJsonFromObject(this.WebService);

src/ResourceManager/MachineLearning/Commands.MachineLearning/Cmdlets/ImportWebServiceDefinition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class ImportWebServiceDefinition : WebServicesCmdletBase
4242
[ValidateNotNullOrEmpty]
4343
public string JsonString { get; set; }
4444

45-
public override void ExecuteCmdlet()
45+
protected override void RunCmdlet()
4646
{
4747
string jsonDefinition = this.JsonString;
4848
if (string.Equals(

src/ResourceManager/MachineLearning/Commands.MachineLearning/Cmdlets/WebServicesCmdletBase.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ public WebServicesClient WebServicesClient
7171

7272
protected override void BeginProcessing()
7373
{
74-
var versionInfo = typeof(WebServicesCmdletBase).Assembly.GetName().Version;
75-
this.WriteVerbose(Resources.VersionInfo.FormatInvariant(versionInfo.ToString(3)));
76-
7774
try
7875
{
7976
if (this.cancellationSource == null)
@@ -85,6 +82,7 @@ protected override void BeginProcessing()
8582
}
8683
catch (Exception ex)
8784
{
85+
this.WriteVersionInfoToVerboseChannel();
8886
if (this.IsFatalException(ex))
8987
{
9088
ThrowTerminatingError(
@@ -108,6 +106,7 @@ protected override void EndProcessing()
108106
}
109107
catch (Exception ex)
110108
{
109+
this.WriteVersionInfoToVerboseChannel();
111110
if (this.IsFatalException(ex))
112111
{
113112
ThrowTerminatingError(
@@ -141,6 +140,7 @@ protected override void StopProcessing()
141140
}
142141
catch (Exception ex)
143142
{
143+
this.WriteVersionInfoToVerboseChannel();
144144
if (this.IsFatalException(ex))
145145
{
146146
throw;
@@ -172,6 +172,8 @@ public override void ExecuteCmdlet()
172172
}
173173
catch (Exception ex)
174174
{
175+
this.WriteVersionInfoToVerboseChannel();
176+
175177
if (this.IsFatalException(ex))
176178
{
177179
throw;
@@ -332,5 +334,10 @@ ex is SecurityException ||
332334
ex is SEHException;
333335
}
334336

337+
private void WriteVersionInfoToVerboseChannel()
338+
{
339+
var versionInfo = typeof(WebServicesCmdletBase).Assembly.GetName().Version;
340+
this.WriteVerbose(Resources.VersionInfo.FormatInvariant(versionInfo.ToString(3)));
341+
}
335342
}
336343
}

0 commit comments

Comments
 (0)