diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 488eca9..5543234 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -1,6 +1,6 @@
name: publish
env:
- VERSION: '0.9.2-preview'
+ VERSION: '0.9.3-preview'
PRERELEASE: true
on:
push:
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index f375db3..813237b 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog
+## 0.9.3-preview
+### Added
+- Additional logging
+
## 0.9.1-2-preview
### Updated
- Update dependencies
diff --git a/sample/Directory.Build.props b/sample/Directory.Build.props
new file mode 100644
index 0000000..15b82d8
--- /dev/null
+++ b/sample/Directory.Build.props
@@ -0,0 +1,5 @@
+
+
+ true
+
+
\ No newline at end of file
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/ExampleWikiOptions.cs b/sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/ExampleWikiOptions.cs
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/ExampleWikiOptions.cs
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/ExampleWikiOptions.cs
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/MainFrontMatter.razor b/sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/MainFrontMatter.razor
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/MainFrontMatter.razor
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/MainFrontMatter.razor
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/Program.cs b/sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/Program.cs
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/Program.cs
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/Program.cs
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/README.md b/sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/README.md
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/README.md
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/README.md
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/ServiceCollectionExtensions.cs b/sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/ServiceCollectionExtensions.cs
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/ServiceCollectionExtensions.cs
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/ServiceCollectionExtensions.cs
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/Services/CustomAuthenticationStateProvider.cs b/sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/Services/CustomAuthenticationStateProvider.cs
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/Services/CustomAuthenticationStateProvider.cs
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/Services/CustomAuthenticationStateProvider.cs
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/Services/DefaultUserManager.cs b/sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/Services/DefaultUserManager.cs
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/Services/DefaultUserManager.cs
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/Services/DefaultUserManager.cs
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/Tavenem.Wiki.Blazor.Example.Client.csproj b/sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/Tavenem.Wiki.Blazor.Example.Client.csproj
similarity index 85%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/Tavenem.Wiki.Blazor.Example.Client.csproj
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/Tavenem.Wiki.Blazor.Example.Client.csproj
index 7513491..181f80d 100644
--- a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/Tavenem.Wiki.Blazor.Example.Client.csproj
+++ b/sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/Tavenem.Wiki.Blazor.Example.Client.csproj
@@ -13,7 +13,7 @@
-
+
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/TopAppBar.razor b/sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/TopAppBar.razor
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/TopAppBar.razor
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/TopAppBar.razor
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/_Imports.razor b/sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/_Imports.razor
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/_Imports.razor
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/_Imports.razor
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/wwwroot/appsettings.Development.json b/sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/wwwroot/appsettings.Development.json
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/wwwroot/appsettings.Development.json
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/wwwroot/appsettings.Development.json
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/wwwroot/appsettings.json b/sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/wwwroot/appsettings.json
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/wwwroot/appsettings.json
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example.Client/wwwroot/appsettings.json
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Components/App.razor b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/Components/App.razor
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Components/App.razor
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example/Components/App.razor
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Components/Pages/Home.razor b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/Components/Pages/Home.razor
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Components/Pages/Home.razor
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example/Components/Pages/Home.razor
diff --git a/sample/Pages/WikiPage.razor b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/Components/Pages/WikiPage.razor
similarity index 100%
rename from sample/Pages/WikiPage.razor
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example/Components/Pages/WikiPage.razor
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Components/Routes.razor b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/Components/Routes.razor
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Components/Routes.razor
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example/Components/Routes.razor
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Components/_Imports.razor b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/Components/_Imports.razor
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Components/_Imports.razor
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example/Components/_Imports.razor
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Program.cs b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/Program.cs
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Program.cs
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example/Program.cs
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Properties/launchSettings.json b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/Properties/launchSettings.json
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Properties/launchSettings.json
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example/Properties/launchSettings.json
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/README.md b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/README.md
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/README.md
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example/README.md
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.csproj b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.csproj
similarity index 86%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.csproj
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.csproj
index aba3ba5..d317ca7 100644
--- a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.csproj
+++ b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/appsettings.Development.json b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/appsettings.Development.json
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/appsettings.Development.json
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example/appsettings.Development.json
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/appsettings.json b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/appsettings.json
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/appsettings.json
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example/appsettings.json
diff --git a/sample/wwwroot/archive.json b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/wwwroot/archive.json
similarity index 100%
rename from sample/wwwroot/archive.json
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example/wwwroot/archive.json
diff --git a/sample/wwwroot/css/app.css b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/wwwroot/css/app.css
similarity index 100%
rename from sample/wwwroot/css/app.css
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example/wwwroot/css/app.css
diff --git a/sample/wwwroot/favicon.ico b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/wwwroot/favicon.ico
similarity index 100%
rename from sample/wwwroot/favicon.ico
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example/wwwroot/favicon.ico
diff --git a/sample/wwwroot/tavenemlogo.svg b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/wwwroot/tavenemlogo.svg
similarity index 100%
rename from sample/wwwroot/tavenemlogo.svg
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example/wwwroot/tavenemlogo.svg
diff --git a/sample/wwwroot/tavenemlogo_sq_inset.svg b/sample/Web App Example/Tavenem.Wiki.Blazor.Example/wwwroot/tavenemlogo_sq_inset.svg
similarity index 100%
rename from sample/wwwroot/tavenemlogo_sq_inset.svg
rename to sample/Web App Example/Tavenem.Wiki.Blazor.Example/wwwroot/tavenemlogo_sq_inset.svg
diff --git a/sample/App.razor b/sample/WebAssembly Example/App.razor
similarity index 100%
rename from sample/App.razor
rename to sample/WebAssembly Example/App.razor
diff --git a/sample/Pages/Index.razor b/sample/WebAssembly Example/Pages/Index.razor
similarity index 100%
rename from sample/Pages/Index.razor
rename to sample/WebAssembly Example/Pages/Index.razor
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Components/Pages/WikiPage.razor b/sample/WebAssembly Example/Pages/WikiPage.razor
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/Components/Pages/WikiPage.razor
rename to sample/WebAssembly Example/Pages/WikiPage.razor
diff --git a/sample/Program.cs b/sample/WebAssembly Example/Program.cs
similarity index 100%
rename from sample/Program.cs
rename to sample/WebAssembly Example/Program.cs
diff --git a/sample/Properties/launchSettings.json b/sample/WebAssembly Example/Properties/launchSettings.json
similarity index 100%
rename from sample/Properties/launchSettings.json
rename to sample/WebAssembly Example/Properties/launchSettings.json
diff --git a/sample/README.md b/sample/WebAssembly Example/README.md
similarity index 100%
rename from sample/README.md
rename to sample/WebAssembly Example/README.md
diff --git a/sample/Services/CustomAuthenticationStateProvider.cs b/sample/WebAssembly Example/Services/CustomAuthenticationStateProvider.cs
similarity index 100%
rename from sample/Services/CustomAuthenticationStateProvider.cs
rename to sample/WebAssembly Example/Services/CustomAuthenticationStateProvider.cs
diff --git a/sample/Services/DefaultUserManager.cs b/sample/WebAssembly Example/Services/DefaultUserManager.cs
similarity index 100%
rename from sample/Services/DefaultUserManager.cs
rename to sample/WebAssembly Example/Services/DefaultUserManager.cs
diff --git a/sample/Shared/TopAppBar.razor b/sample/WebAssembly Example/Shared/TopAppBar.razor
similarity index 100%
rename from sample/Shared/TopAppBar.razor
rename to sample/WebAssembly Example/Shared/TopAppBar.razor
diff --git a/sample/Shared/TopAppBar.razor.cs b/sample/WebAssembly Example/Shared/TopAppBar.razor.cs
similarity index 100%
rename from sample/Shared/TopAppBar.razor.cs
rename to sample/WebAssembly Example/Shared/TopAppBar.razor.cs
diff --git a/sample/Tavenem.Wiki.Blazor.Sample.csproj b/sample/WebAssembly Example/Tavenem.Wiki.Blazor.Sample.csproj
similarity index 89%
rename from sample/Tavenem.Wiki.Blazor.Sample.csproj
rename to sample/WebAssembly Example/Tavenem.Wiki.Blazor.Sample.csproj
index 8d05e3a..1be5935 100644
--- a/sample/Tavenem.Wiki.Blazor.Sample.csproj
+++ b/sample/WebAssembly Example/Tavenem.Wiki.Blazor.Sample.csproj
@@ -15,7 +15,7 @@
-
+
diff --git a/sample/_Imports.razor b/sample/WebAssembly Example/_Imports.razor
similarity index 100%
rename from sample/_Imports.razor
rename to sample/WebAssembly Example/_Imports.razor
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/wwwroot/archive.json b/sample/WebAssembly Example/wwwroot/archive.json
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/wwwroot/archive.json
rename to sample/WebAssembly Example/wwwroot/archive.json
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/wwwroot/css/app.css b/sample/WebAssembly Example/wwwroot/css/app.css
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/wwwroot/css/app.css
rename to sample/WebAssembly Example/wwwroot/css/app.css
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/wwwroot/favicon.ico b/sample/WebAssembly Example/wwwroot/favicon.ico
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/wwwroot/favicon.ico
rename to sample/WebAssembly Example/wwwroot/favicon.ico
diff --git a/sample/wwwroot/index.html b/sample/WebAssembly Example/wwwroot/index.html
similarity index 100%
rename from sample/wwwroot/index.html
rename to sample/WebAssembly Example/wwwroot/index.html
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/wwwroot/tavenemlogo.svg b/sample/WebAssembly Example/wwwroot/tavenemlogo.svg
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/wwwroot/tavenemlogo.svg
rename to sample/WebAssembly Example/wwwroot/tavenemlogo.svg
diff --git a/src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/wwwroot/tavenemlogo_sq_inset.svg b/sample/WebAssembly Example/wwwroot/tavenemlogo_sq_inset.svg
similarity index 100%
rename from src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example/wwwroot/tavenemlogo_sq_inset.svg
rename to sample/WebAssembly Example/wwwroot/tavenemlogo_sq_inset.svg
diff --git a/src/Client/Internal/WikiState.cs b/src/Client/Internal/WikiState.cs
index b5d888e..1b9900b 100644
--- a/src/Client/Internal/WikiState.cs
+++ b/src/Client/Internal/WikiState.cs
@@ -45,7 +45,6 @@ public string DisplayTitle
///
public bool LoadError { get; internal set; }
- private bool _notAuthorized;
///
///
/// Whether the current user is not authorized to complete the current action (e.g. view or edit
@@ -58,8 +57,8 @@ public string DisplayTitle
///
public bool NotAuthorized
{
- get => _notAuthorized;
- set => _notAuthorized |= value;
+ get;
+ set => field |= value;
}
///
diff --git a/src/Client/Services/WikiDataService.cs b/src/Client/Services/WikiDataService.cs
index 6e98baf..1697f44 100644
--- a/src/Client/Services/WikiDataService.cs
+++ b/src/Client/Services/WikiDataService.cs
@@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
using System.Net.Http.Json;
using System.Security.Claims;
using System.Text;
@@ -20,6 +21,7 @@ namespace Tavenem.Wiki.Blazor.Client.Services;
///
public class WikiDataService(
LocalWikiDataService localWikiDataService,
+ ILoggerFactory loggerFactory,
NavigationManager navigationManager,
IServiceProvider serviceProvider,
SnackbarService snackbarService,
@@ -27,6 +29,8 @@ public class WikiDataService(
WikiOptions wikiOptions,
WikiState wikiState)
{
+ private readonly ILogger _logger = loggerFactory.CreateLogger("Wiki");
+
private AuthenticationStateProvider? _authenticationStateProvider;
private HttpClient? _httpClient;
@@ -373,7 +377,11 @@ public Task EditAsync(EditRequest request, string? failMessage = null) =>
}
catch (Exception ex)
{
- Console.WriteLine(ex);
+ _logger.Log(
+ LogLevel.Error,
+ ex,
+ "Error getting talk messages for wiki item with title {Title}.",
+ title);
snackbarService.Add("An error occurred", ThemeColor.Danger);
}
return messages;
@@ -578,6 +586,9 @@ public Task RestoreArchiveAsync(Archive archive) => PostAsync(
}
else if (response.StatusCode == System.Net.HttpStatusCode.BadRequest)
{
+ _logger.LogWarning(
+ "Bad request when fetching data from url {URL}.",
+ url);
snackbarService.Add(response.ReasonPhrase ?? "Invalid operation", ThemeColor.Warning);
return default;
}
@@ -595,7 +606,11 @@ public Task RestoreArchiveAsync(Archive archive) => PostAsync(
catch (HttpRequestException) { }
catch (Exception ex)
{
- Console.WriteLine(ex);
+ _logger.Log(
+ LogLevel.Error,
+ ex,
+ "Error fetching data from url {URL}.",
+ url);
snackbarService.Add("An error occurred", ThemeColor.Danger);
return default;
}
@@ -614,6 +629,11 @@ public Task RestoreArchiveAsync(Archive archive) => PostAsync(
}
catch (Exception ex)
{
+ _logger.Log(
+ LogLevel.Error,
+ ex,
+ "Error fetching data locally for url {URL}.",
+ url);
wikiState.LoadError = true;
snackbarService.Add(ex.Message ?? "Invalid operation", ThemeColor.Warning);
return default;
@@ -661,6 +681,9 @@ private async Task FetchIntAsync(
}
else if (response.StatusCode == System.Net.HttpStatusCode.BadRequest)
{
+ _logger.LogWarning(
+ "Bad request when fetching data from url {URL}.",
+ url);
snackbarService.Add(response.ReasonPhrase ?? "Invalid operation", ThemeColor.Warning);
return 0;
}
@@ -681,7 +704,11 @@ private async Task FetchIntAsync(
catch (HttpRequestException) { }
catch (Exception ex)
{
- Console.WriteLine(ex);
+ _logger.Log(
+ LogLevel.Error,
+ ex,
+ "Error fetching data from url {URL}.",
+ url);
snackbarService.Add("An error occurred", ThemeColor.Danger);
return 0;
}
@@ -698,13 +725,13 @@ private async Task FetchIntAsync(
HandleUnauthorized(state);
return 0;
}
- catch (InvalidOperationException ex)
- {
- snackbarService.Add(ex.Message ?? "Invalid operation", ThemeColor.Warning);
- return 0;
- }
- catch (ArgumentException ex)
+ catch (Exception ex)
{
+ _logger.Log(
+ LogLevel.Error,
+ ex,
+ "Error fetching data locally for url {URL}.",
+ url);
snackbarService.Add(ex.Message ?? "Invalid operation", ThemeColor.Warning);
return 0;
}
@@ -751,6 +778,9 @@ private async Task FetchIntAsync(
}
else if (response.StatusCode == System.Net.HttpStatusCode.BadRequest)
{
+ _logger.LogWarning(
+ "Bad request when fetching data from url {URL}.",
+ url);
snackbarService.Add(response.ReasonPhrase ?? "Invalid operation", ThemeColor.Warning);
return null;
}
@@ -771,7 +801,11 @@ private async Task FetchIntAsync(
catch (HttpRequestException) { }
catch (Exception ex)
{
- Console.WriteLine(ex);
+ _logger.Log(
+ LogLevel.Error,
+ ex,
+ "Error fetching data from url {URL}.",
+ url);
snackbarService.Add("An error occurred", ThemeColor.Danger);
return null;
}
@@ -788,13 +822,13 @@ private async Task FetchIntAsync(
HandleUnauthorized(state);
return null;
}
- catch (InvalidOperationException ex)
- {
- snackbarService.Add(ex.Message ?? "Invalid operation", ThemeColor.Warning);
- return null;
- }
- catch (ArgumentException ex)
+ catch (Exception ex)
{
+ _logger.Log(
+ LogLevel.Error,
+ ex,
+ "Error fetching data locally for url {URL}.",
+ url);
snackbarService.Add(ex.Message ?? "Invalid operation", ThemeColor.Warning);
return null;
}
@@ -854,6 +888,9 @@ private async Task FetchIntAsync(
}
else if (response.StatusCode == System.Net.HttpStatusCode.BadRequest)
{
+ _logger.LogWarning(
+ "Bad request when posting data to url {URL}.",
+ url);
snackbarService.Add(response.ReasonPhrase ?? "Invalid operation", ThemeColor.Warning);
return default;
}
@@ -871,7 +908,11 @@ private async Task FetchIntAsync(
catch (HttpRequestException) { }
catch (Exception ex)
{
- Console.WriteLine(ex);
+ _logger.Log(
+ LogLevel.Error,
+ ex,
+ "Error posting data to url {URL}.",
+ url);
snackbarService.Add("An error occurred", ThemeColor.Danger);
return default;
}
@@ -890,13 +931,13 @@ private async Task FetchIntAsync(
HandleUnauthorized(state);
return default;
}
- catch (InvalidOperationException ex)
- {
- snackbarService.Add(ex.Message ?? "Invalid operation", ThemeColor.Warning);
- return default;
- }
- catch (ArgumentException ex)
+ catch (Exception ex)
{
+ _logger.Log(
+ LogLevel.Error,
+ ex,
+ "Error posting data locally for url {URL}.",
+ url);
snackbarService.Add(ex.Message ?? "Invalid operation", ThemeColor.Warning);
return default;
}
@@ -959,6 +1000,9 @@ private async Task PostAsync(
}
else if (response.StatusCode == System.Net.HttpStatusCode.BadRequest)
{
+ _logger.LogWarning(
+ "Bad request when posting data to url {URL}.",
+ url);
snackbarService.Add(response.ReasonPhrase ?? "Invalid operation", ThemeColor.Warning);
return false;
}
@@ -975,7 +1019,11 @@ private async Task PostAsync(
catch (HttpRequestException) { }
catch (Exception ex)
{
- Console.WriteLine(ex);
+ _logger.Log(
+ LogLevel.Error,
+ ex,
+ "Error posting data to url {URL}.",
+ url);
snackbarService.Add("An error occurred", ThemeColor.Danger);
return false;
}
@@ -997,13 +1045,13 @@ private async Task PostAsync(
HandleUnauthorized(state);
return false;
}
- catch (InvalidOperationException ex)
- {
- snackbarService.Add(ex.Message ?? "Invalid operation", ThemeColor.Warning);
- return false;
- }
- catch (ArgumentException ex)
+ catch (Exception ex)
{
+ _logger.Log(
+ LogLevel.Error,
+ ex,
+ "Error posting data locally for url {URL}.",
+ url);
snackbarService.Add(ex.Message ?? "Invalid operation", ThemeColor.Warning);
return false;
}
@@ -1058,6 +1106,9 @@ private async Task PostAsync(
}
else if (response.StatusCode == System.Net.HttpStatusCode.BadRequest)
{
+ _logger.LogWarning(
+ "Bad request when posting data to url {URL}.",
+ url);
snackbarService.Add(response.ReasonPhrase ?? "Invalid operation", ThemeColor.Warning);
return default;
}
@@ -1075,7 +1126,11 @@ private async Task PostAsync(
catch (HttpRequestException) { }
catch (Exception ex)
{
- Console.WriteLine(ex);
+ _logger.Log(
+ LogLevel.Error,
+ ex,
+ "Error posting data to url {URL}.",
+ url);
snackbarService.Add("An error occurred", ThemeColor.Danger);
return default;
}
@@ -1093,13 +1148,13 @@ private async Task PostAsync(
HandleUnauthorized(state);
return default;
}
- catch (InvalidOperationException ex)
- {
- snackbarService.Add(ex.Message ?? "Invalid operation", ThemeColor.Warning);
- return default;
- }
- catch (ArgumentException ex)
+ catch (Exception ex)
{
+ _logger.Log(
+ LogLevel.Error,
+ ex,
+ "Error posting data locally for url {URL}.",
+ url);
snackbarService.Add(ex.Message ?? "Invalid operation", ThemeColor.Warning);
return default;
}
diff --git a/src/Tavenem.Wiki.Blazor.sln b/src/Tavenem.Wiki.Blazor.sln
index b48480a..6dd3322 100644
--- a/src/Tavenem.Wiki.Blazor.sln
+++ b/src/Tavenem.Wiki.Blazor.sln
@@ -19,11 +19,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tavenem.Wiki.Blazor.Server"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tavenem.Wiki.Blazor.Client", "Client\Tavenem.Wiki.Blazor.Client.csproj", "{236B5D43-2022-408E-BBFD-20D516FA6EE3}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tavenem.Wiki.Blazor.Sample", "..\sample\Tavenem.Wiki.Blazor.Sample.csproj", "{6EE499B5-A0BD-4B46-83B6-762F98E84FAF}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tavenem.Wiki.Blazor.Sample", "..\sample\WebAssembly Example\Tavenem.Wiki.Blazor.Sample.csproj", "{6EE499B5-A0BD-4B46-83B6-762F98E84FAF}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tavenem.Wiki.Blazor.Example", "Tavenem.Wiki.Blazor.Example\Tavenem.Wiki.Blazor.Example\Tavenem.Wiki.Blazor.Example.csproj", "{1E3B3151-F952-4631-9131-DCCE67EB9CDA}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tavenem.Wiki.Blazor.Example", "..\sample\Web App Example\Tavenem.Wiki.Blazor.Example\Tavenem.Wiki.Blazor.Example.csproj", "{1E3B3151-F952-4631-9131-DCCE67EB9CDA}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tavenem.Wiki.Blazor.Example.Client", "Tavenem.Wiki.Blazor.Example\Tavenem.Wiki.Blazor.Example.Client\Tavenem.Wiki.Blazor.Example.Client.csproj", "{952E9D86-1472-4533-B825-8EB1FAA9EF82}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tavenem.Wiki.Blazor.Example.Client", "..\sample\Web App Example\Tavenem.Wiki.Blazor.Example.Client\Tavenem.Wiki.Blazor.Example.Client.csproj", "{952E9D86-1472-4533-B825-8EB1FAA9EF82}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution