Skip to content

Commit 2911b7b

Browse files
committed
Bubble try/catch ex message to Localized string
1 parent 49f08c1 commit 2911b7b

23 files changed

Lines changed: 53 additions & 55 deletions

src/BuildingBlocks/Shared/Localization/SharedResource.resx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,7 @@
243243
<data name="AccountCreatedSuccessfully" xml:space="preserve">
244244
<value>Account created successfully! Please check your email to confirm your account.</value>
245245
</data>
246-
<data name="UnexpectedErrorOccurred" xml:space="preserve">
247-
<value>An unexpected error occurred. Please try again.</value>
248-
</data>
246+
<data name="UnexpectedErrorOccurred" xml:space="preserve"><value>An unexpected error occurred: {0}</value></data>
249247
<data name="Login" xml:space="preserve">
250248
<value>Login</value>
251249
</data>

src/Playground/Playground.Blazor/Components/Pages/Audits.razor

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@
741741
}
742742
catch (Exception ex)
743743
{
744-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
744+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
745745
return new TableData<FSH.Playground.Blazor.ApiClient.AuditSummaryDto>
746746
{
747747
Items = Array.Empty<FSH.Playground.Blazor.ApiClient.AuditSummaryDto>(),
@@ -826,7 +826,7 @@
826826
}
827827
catch (Exception ex)
828828
{
829-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
829+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
830830
_expanded.Remove(audit.Id);
831831
}
832832
}
@@ -852,7 +852,7 @@
852852
}
853853
catch (Exception ex)
854854
{
855-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
855+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
856856
}
857857
finally
858858
{
@@ -882,7 +882,7 @@
882882
}
883883
catch (Exception ex)
884884
{
885-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
885+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
886886
}
887887
finally
888888
{
@@ -1028,7 +1028,7 @@
10281028
}
10291029
catch (Exception ex)
10301030
{
1031-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
1031+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
10321032
}
10331033
}
10341034

src/Playground/Playground.Blazor/Components/Pages/Dashboard/DashboardPage.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
}
9191
catch (Exception ex)
9292
{
93-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
93+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
9494
}
9595
}
9696

@@ -109,7 +109,7 @@
109109
}
110110
catch (Exception ex)
111111
{
112-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
112+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
113113
}
114114
}
115115

src/Playground/Playground.Blazor/Components/Pages/Groups/AddMembersDialog.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
}
160160
catch (Exception ex)
161161
{
162-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
162+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
163163
}
164164
finally
165165
{
@@ -245,7 +245,7 @@
245245
}
246246
catch (Exception ex)
247247
{
248-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
248+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
249249
}
250250
finally
251251
{

src/Playground/Playground.Blazor/Components/Pages/Groups/CreateGroupDialog.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@
268268
}
269269
catch (Exception ex)
270270
{
271-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
271+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
272272
}
273273
finally
274274
{

src/Playground/Playground.Blazor/Components/Pages/Groups/GroupMembersPage.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@
209209
}
210210
catch (Exception ex)
211211
{
212-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
212+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
213213
}
214214
}
215215

@@ -224,7 +224,7 @@
224224
}
225225
catch (Exception ex)
226226
{
227-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
227+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
228228
}
229229
finally
230230
{
@@ -313,7 +313,7 @@
313313
}
314314
catch (Exception ex)
315315
{
316-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
316+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
317317
}
318318
finally
319319
{

src/Playground/Playground.Blazor/Components/Pages/Groups/GroupsPage.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@
290290
}
291291
catch (Exception ex)
292292
{
293-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
293+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
294294
}
295295
finally
296296
{
@@ -429,7 +429,7 @@
429429
}
430430
catch (Exception ex)
431431
{
432-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
432+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
433433
}
434434
finally
435435
{

src/Playground/Playground.Blazor/Components/Pages/Health/HealthPage.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@
234234
}
235235
catch (Exception ex)
236236
{
237-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
237+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
238238
_healthHistory.Add(new HealthRecord
239239
{
240240
Time = DateTime.Now,

src/Playground/Playground.Blazor/Components/Pages/ProfileSettings.razor

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ else
391391
}
392392
catch (Exception ex)
393393
{
394-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
394+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
395395
}
396396
finally
397397
{
@@ -448,7 +448,7 @@ else
448448
}
449449
catch (Exception ex)
450450
{
451-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
451+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
452452
}
453453
}
454454

@@ -534,11 +534,11 @@ else
534534
}
535535
catch (FSH.Playground.Blazor.ApiClient.ApiException ex)
536536
{
537-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
537+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
538538
}
539539
catch (Exception ex)
540540
{
541-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
541+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
542542
}
543543
finally
544544
{
@@ -601,11 +601,11 @@ else
601601
}
602602
catch (FSH.Playground.Blazor.ApiClient.ApiException ex)
603603
{
604-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
604+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
605605
}
606606
catch (Exception ex)
607607
{
608-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
608+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
609609
}
610610
finally
611611
{

src/Playground/Playground.Blazor/Components/Pages/Roles/CreateRoleDialog.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
}
149149
catch (Exception ex)
150150
{
151-
Snackbar.Add(L["UnexpectedErrorOccurred"], Severity.Error);
151+
Snackbar.Add(string.Format(L["UnexpectedErrorOccurred"], ex.Message), Severity.Error);
152152
}
153153
finally
154154
{

0 commit comments

Comments
 (0)