chore: Better error message when join room failed
This commit is contained in:
parent
325431c8f6
commit
5fc75ac307
3 changed files with 13 additions and 7 deletions
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue