From 75c0bba40a4be955540c29f1cc1bbcae66563f0d Mon Sep 17 00:00:00 2001 From: Vitaliy Bezugly Date: Wed, 20 Mar 2024 12:16:04 +0200 Subject: [PATCH] Better error handling --- Apps.Lionbridge/Actions/SupportAssetsActions.cs | 2 +- Apps.Lionbridge/LionbridgeInvocable.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Apps.Lionbridge/Actions/SupportAssetsActions.cs b/Apps.Lionbridge/Actions/SupportAssetsActions.cs index f4d7985..673d1b4 100644 --- a/Apps.Lionbridge/Actions/SupportAssetsActions.cs +++ b/Apps.Lionbridge/Actions/SupportAssetsActions.cs @@ -49,7 +49,7 @@ public async Task AddSupportAsset([ActionParameter] GetJob var apiRequest = new LionbridgeRequest(endpoint, Method.Post) .AddJsonBody(new { - fmsFileId = uploadResponse.FmsFileId, + fmsFileId = uploadResponse.FmsFileId ?? throw new Exception("FMS file ID is missing"), description = addSupportAssetRequest.Description, sourceNativeIds = addSupportAssetRequest.SourceNativeIds ?? new List { Guid.NewGuid().ToString() }, sourceNativeLanguageCode = addSupportAssetRequest.SourceNativeLanguageCode, diff --git a/Apps.Lionbridge/LionbridgeInvocable.cs b/Apps.Lionbridge/LionbridgeInvocable.cs index 312344e..9704d89 100644 --- a/Apps.Lionbridge/LionbridgeInvocable.cs +++ b/Apps.Lionbridge/LionbridgeInvocable.cs @@ -44,7 +44,7 @@ protected async Task UploadFmsFile(string jobId, AddFi string fmsMultipartUrl = response.FmsPostMultipartUrl; var fileStream = await fileManagementClient.DownloadAsync(fileRequest.File); - var memoryStream = new MemoryStream(); + using var memoryStream = new MemoryStream(); await fileStream.CopyToAsync(memoryStream); var bytes = memoryStream.ToArray();