Skip to content

Commit f979353

Browse files
committed
Move exception messages to resource file
1 parent 73f1db1 commit f979353

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

src/ServiceManagement/Compute/Commands.ServiceManagement/Common/DiagnosticsHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,18 @@ public static Hashtable GetPublicDiagnosticsConfiguration(string config, string
7171
int wadCfgBeginIndex = config.IndexOf("<WadCfg>");
7272
if (wadCfgBeginIndex == -1)
7373
{
74-
throw new ArgumentException("Cannot find the WadCfg element in the config.");
74+
throw new ArgumentException(Properties.Resources.DiagnosticsExtensionXmlConfigNoWadCfgStartTag);
7575
}
7676

7777
int wadCfgEndIndex = config.IndexOf("</WadCfg>");
7878
if (wadCfgEndIndex == -1)
7979
{
80-
throw new ArgumentException("Cannot find the WadCfg end element in the config.");
80+
throw new ArgumentException(Properties.Resources.DiagnosticsExtensionXmlConfigNoWadCfgEndTag);
8181
}
8282

8383
if (wadCfgEndIndex <= wadCfgBeginIndex)
8484
{
85-
throw new ArgumentException("WadCfg start element in the config is not matching the end element.");
85+
throw new ArgumentException(Properties.Resources.DiagnosticsExtensionXmlConfigWadCfgTagNotMatch);
8686
}
8787

8888
string encodedConfiguration = Convert.ToBase64String(

src/ServiceManagement/Compute/Commands.ServiceManagement/Properties/Resources.Designer.cs

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ServiceManagement/Compute/Commands.ServiceManagement/Properties/Resources.resx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,4 +774,13 @@
774774
<data name="DiagnosticsExtensionNullStorageAccountName" xml:space="preserve">
775775
<value>Storage account name is not specified.</value>
776776
</data>
777+
<data name="DiagnosticsExtensionXmlConfigNoWadCfgEndTag" xml:space="preserve">
778+
<value>Cannot find the WadCfg end element in the config.</value>
779+
</data>
780+
<data name="DiagnosticsExtensionXmlConfigNoWadCfgStartTag" xml:space="preserve">
781+
<value>Cannot find the WadCfg element in the config.</value>
782+
</data>
783+
<data name="DiagnosticsExtensionXmlConfigWadCfgTagNotMatch" xml:space="preserve">
784+
<value>WadCfg start element in the config is not matching the end element.</value>
785+
</data>
777786
</root>

0 commit comments

Comments
 (0)