Improve error handling and logging for envelope receiver

Added a null check in `EnvelopeReceiverPage.razor` to log a warning when `_envelopeReceiver` is null. Updated `ReportViewer.razor` to wrap `EnvelopeReceiverService.GetAsync` in a `try-catch` block, logging `HttpRequestException` errors and allowing the UI to handle null values gracefully.

Enhanced `EnvelopeReceiverService.GetAsync` to throw detailed `HttpRequestException` on API failures, including status code and reason phrase. Added `using System.Net;` to support HTTP-related classes. Updated method documentation to reflect the new behavior.

These changes improve error diagnostics, logging, and maintainability across the codebase.
This commit is contained in:
2026-06-11 13:40:30 +02:00
parent 7001d7351f
commit 7d0c5a0ee5
3 changed files with 25 additions and 2 deletions

View File

@@ -576,6 +576,10 @@ const int MaxThumbnailWidth = 400;
_signatures = signatures.Convert(UnitOfLength.Point);
_envelopeReceiver = await EnvelopeReceiverService.GetAsync(EnvelopeKey);
if (_envelopeReceiver is null)
{
logger.LogWarning("Envelope receiver data is null for envelope {EnvelopeKey}", EnvelopeKey);
}
await JSRuntime.InvokeVoidAsync("console.log", "Loaded signatures:", _signatures);