Skip to content

Commit e3be17a

Browse files
All error message are now updated to support localization
1 parent 4224b28 commit e3be17a

File tree

3 files changed

+90
-6
lines changed

3 files changed

+90
-6
lines changed

src/ResourceManager/AzureBatch/Commands.Batch/Models/BatchClient.Applications.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,13 @@ private void UploadFileToApplicationPackage(
226226
catch
227227
{
228228
// Need to throw if we fail to delete the application while attempting to clean it up.
229-
var deleteMessage = string.Format("Uploading {0} to storage failed and the attempt to delete the application package afterwards failed ({1})", filePath, exception.Message);
229+
var deleteMessage = string.Format(Resources.FailedToUploadAndDelete, filePath, exception.Message);
230230
throw new UploadApplicationPackageException(deleteMessage, exception);
231231
}
232232
}
233233

234234
// Need to throw if we fail to upload the file's content.
235-
var uploadMessage = string.Format("Failed to upload {0} to storage ({1})", filePath, exception.Message);
235+
var uploadMessage = string.Format(Resources.FailedToUpload, filePath, exception.Message);
236236
throw new UploadApplicationPackageException(uploadMessage, exception);
237237
}
238238
}
@@ -266,10 +266,10 @@ private void ActivateApplicationPackage(string resourceGroupName, string account
266266
}
267267
catch (Exception exception)
268268
{
269-
string message = string.Format("Application package {0} version {1} successfully uploaded but failed to activate ({2})", applicationId, version, exception.Message);
269+
string message = string.Format(Resources.UploadedApplicationButFailedToActivate, applicationId, version, exception.Message);
270270
if (activateOnly)
271271
{
272-
message = string.Format("Application package {0} version {1} failed to activate ({2})", applicationId, version, exception.Message);
272+
message = string.Format(Resources.FailedToActivate, applicationId, version, exception.Message);
273273
}
274274

275275
throw new ActivateApplicationPackageException(message, exception);
@@ -295,7 +295,7 @@ private string GetStorageUrl(string resourceGroupName, string accountName, strin
295295
// If the application package is not found we want to create a new application package.
296296
if (exception.Response.StatusCode != HttpStatusCode.NotFound)
297297
{
298-
var message = string.Format("Failed to get application {0} package {1}. You may need to delete the application package and try uploading again ({2})", applicationId, version, exception.Message);
298+
var message = string.Format(Resources.FailedToGetApplicationPackage, applicationId, version, exception.Message);
299299
throw new CloudException(message, exception);
300300
}
301301
}
@@ -314,7 +314,7 @@ private string GetStorageUrl(string resourceGroupName, string accountName, strin
314314
}
315315
catch (Exception exception)
316316
{
317-
var message = string.Format("Failed to add application package {0} version {1} ({2})", applicationId, version, exception.Message);
317+
var message = string.Format(Resources.FailedToAddApplicationPackage, applicationId, version, exception.Message);
318318
throw new AddApplicationPackageException(message, exception);
319319
}
320320
}

src/ResourceManager/AzureBatch/Commands.Batch/Properties/Resources.Designer.cs

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

src/ResourceManager/AzureBatch/Commands.Batch/Properties/Resources.resx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,4 +442,22 @@
442442
<data name="FileNotFound" xml:space="preserve">
443443
<value>File not found {0}.</value>
444444
</data>
445+
<data name="FailedToUpload" xml:space="preserve">
446+
<value>Failed to upload {0} to storage ({1}).</value>
447+
</data>
448+
<data name="FailedToUploadAndDelete" xml:space="preserve">
449+
<value>Uploading {0} to storage failed and the attempt to delete the application package afterwards failed ({1}).</value>
450+
</data>
451+
<data name="UploadedApplicationButFailedToActivate" xml:space="preserve">
452+
<value>Application package {0} version {1} successfully uploaded but failed to activate ({2}).</value>
453+
</data>
454+
<data name="FailedToActivate" xml:space="preserve">
455+
<value>Application package {0} version {1} failed to activate ({2}).</value>
456+
</data>
457+
<data name="FailedToGetApplicationPackage" xml:space="preserve">
458+
<value>Failed to get application {0} package {1}. You may need to delete the application package and try uploading again ({2}).</value>
459+
</data>
460+
<data name="FailedToAddApplicationPackage" xml:space="preserve">
461+
<value>"Failed to add application package {0} version {1} ({2})."</value>
462+
</data>
445463
</root>

0 commit comments

Comments
 (0)