chore: Better error message when join room failed

This commit is contained in:
Krille 2024-11-19 12:15:13 +01:00
commit 5fc75ac307
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
3 changed files with 13 additions and 7 deletions

View file

@ -17,9 +17,9 @@ Future<Result<T>> showFutureLoadingDialog<T>({
required Future<T> Function() future,
String? title,
String? backLabel,
String Function(dynamic exception)? onError,
bool barrierDismissible = false,
bool delay = true,
ExceptionContext? exceptionContext,
}) async {
final futureExec = future();
final resultFuture = ResultFuture(futureExec);
@ -44,7 +44,7 @@ Future<Result<T>> showFutureLoadingDialog<T>({
future: futureExec,
title: title,
backLabel: backLabel,
onError: onError,
exceptionContext: exceptionContext,
),
);
return result ??
@ -58,14 +58,14 @@ class LoadingDialog<T> extends StatefulWidget {
final String? title;
final String? backLabel;
final Future<T> future;
final String Function(dynamic exception)? onError;
final ExceptionContext? exceptionContext;
const LoadingDialog({
super.key,
required this.future,
this.title,
this.onError,
this.backLabel,
this.exceptionContext,
});
@override
LoadingDialogState<T> createState() => LoadingDialogState<T>();
@ -91,8 +91,7 @@ class LoadingDialogState<T> extends State<LoadingDialog> {
Widget build(BuildContext context) {
final exception = this.exception;
final titleLabel = exception != null
? widget.onError?.call(exception) ??
exception.toLocalizedString(context)
? exception.toLocalizedString(context, widget.exceptionContext)
: widget.title ?? L10n.of(context).loadingPleaseWait;
return AlertDialog.adaptive(