don't show errors when url preview fails
This commit is contained in:
parent
eca9d3b411
commit
5f13d3fbf5
1 changed files with 9 additions and 3 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import "package:flutter/widgets.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
import "package:nexus/controllers/client.dart";
|
||||
import "package:nexus/models/open_graph_data.dart";
|
||||
|
|
@ -10,9 +11,14 @@ class UrlPreviewController extends AsyncNotifier<OpenGraphData?> {
|
|||
Future<OpenGraphData?> build() async {
|
||||
if (url.host == "matrix.to") return null;
|
||||
|
||||
return await ref
|
||||
.watch(ClientController.provider.notifier)
|
||||
.getUrlPreview(url);
|
||||
try {
|
||||
return await ref
|
||||
.watch(ClientController.provider.notifier)
|
||||
.getUrlPreview(url);
|
||||
} catch (error, stackTrace) {
|
||||
debugPrintStack(label: error.toString(), stackTrace: stackTrace);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static final provider =
|
||||
|
|
|
|||
Loading…
Reference in a new issue