From 19be77ed49041cdce211ccf4ae124b73f86c7ed4 Mon Sep 17 00:00:00 2001 From: Shaun Walker Date: Mon, 22 Nov 2021 16:11:44 -0500 Subject: [PATCH] refactored ErrorBoundary implementation to support logging --- Oqtane.Client/Modules/HtmlText/Edit.razor | 6 +- Oqtane.Client/Modules/HtmlText/Index.razor | 14 +- .../Resources/Modules/HtmlText/Edit.resx | 5 +- .../Resources/Modules/HtmlText/Index.resx | 119 ++++++------- .../Resources/UI/ModuleInstance.resx | 4 +- Oqtane.Client/UI/ModuleInstance.razor | 156 ++++++++++-------- 6 files changed, 161 insertions(+), 143 deletions(-) diff --git a/Oqtane.Client/Modules/HtmlText/Edit.razor b/Oqtane.Client/Modules/HtmlText/Edit.razor index bc94cebc..5fc59bfc 100644 --- a/Oqtane.Client/Modules/HtmlText/Edit.razor +++ b/Oqtane.Client/Modules/HtmlText/Edit.razor @@ -65,8 +65,8 @@ } catch (Exception ex) { - await logger.LogError(ex, "An Error Occurred Loading Html/Text Content. " + ex.Message); - AddModuleMessage(ex.Message, MessageType.Error); + await logger.LogError(ex, "Error Loading Content {Error}", ex.Message); + AddModuleMessage(Localizer["Error.Content.Load"], MessageType.Error); } } @@ -91,7 +91,7 @@ await HtmlTextService.AddHtmlTextAsync(htmltext); } - await logger.LogInformation("Html/Text Content Saved {HtmlText}", htmltext); + await logger.LogInformation("Content Saved {HtmlText}", htmltext); NavigationManager.NavigateTo(NavigateUrl()); } catch (Exception ex) diff --git a/Oqtane.Client/Modules/HtmlText/Index.razor b/Oqtane.Client/Modules/HtmlText/Index.razor index 57a95cef..4428d033 100644 --- a/Oqtane.Client/Modules/HtmlText/Index.razor +++ b/Oqtane.Client/Modules/HtmlText/Index.razor @@ -15,16 +15,16 @@ } @code { - public override List Resources => new List() + public override List Resources => new List() { new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" } }; - private string content = ""; + private string content = ""; - protected override async Task OnParametersSetAsync() - { - try + protected override async Task OnParametersSetAsync() + { + try { var htmltext = await HtmlTextService.GetHtmlTextAsync(ModuleState.ModuleId); if (htmltext != null) @@ -35,8 +35,8 @@ } catch (Exception ex) { - await logger.LogError(ex, "An Error Occurred Loading Html/Text Content. " + ex.Message); - AddModuleMessage(ex.Message, MessageType.Error); + await logger.LogError(ex, "Error Loading Content {Error}", ex.Message); + AddModuleMessage(Localizer["Error.Content.Load"], MessageType.Error); } } } \ No newline at end of file diff --git a/Oqtane.Client/Resources/Modules/HtmlText/Edit.resx b/Oqtane.Client/Resources/Modules/HtmlText/Edit.resx index 0439bfae..e2eed7a2 100644 --- a/Oqtane.Client/Resources/Modules/HtmlText/Edit.resx +++ b/Oqtane.Client/Resources/Modules/HtmlText/Edit.resx @@ -117,7 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + An Error Occurred Loading Content + - Error Saving Content + An Error Occurred Saving Content \ No newline at end of file diff --git a/Oqtane.Client/Resources/Modules/HtmlText/Index.resx b/Oqtane.Client/Resources/Modules/HtmlText/Index.resx index 7c534702..1e0f92e6 100644 --- a/Oqtane.Client/Resources/Modules/HtmlText/Index.resx +++ b/Oqtane.Client/Resources/Modules/HtmlText/Index.resx @@ -1,65 +1,65 @@  - + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + @@ -120,4 +120,7 @@ Edit + + An Error Occurred Loading Content + \ No newline at end of file diff --git a/Oqtane.Client/Resources/UI/ModuleInstance.resx b/Oqtane.Client/Resources/UI/ModuleInstance.resx index a10f61d6..fc0994f2 100644 --- a/Oqtane.Client/Resources/UI/ModuleInstance.resx +++ b/Oqtane.Client/Resources/UI/ModuleInstance.resx @@ -1,4 +1,4 @@ - +