nicer error handling for message parses
This commit is contained in:
parent
8c047827de
commit
3310d9b907
2 changed files with 14 additions and 8 deletions
|
|
@ -21,11 +21,12 @@ class ErrorDialog extends ConsumerWidget {
|
||||||
onPressed: () => ref.invalidate(provider!),
|
onPressed: () => ref.invalidate(provider!),
|
||||||
child: const Text("Try Again"),
|
child: const Text("Try Again"),
|
||||||
),
|
),
|
||||||
TextButton(
|
if (Navigator.of(context).canPop())
|
||||||
onPressed: () =>
|
TextButton(
|
||||||
Navigator.of(context).popUntil((route) => route.isFirst),
|
onPressed: () =>
|
||||||
child: const Text("Go Back"),
|
Navigator.of(context).popUntil((route) => route.isFirst),
|
||||||
),
|
child: const Text("Go Back"),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import "package:nexus/models/content/server_acl.dart";
|
||||||
import "package:nexus/models/content/sticker.dart";
|
import "package:nexus/models/content/sticker.dart";
|
||||||
import "package:nexus/models/content/topic.dart";
|
import "package:nexus/models/content/topic.dart";
|
||||||
import "package:nexus/models/event.dart";
|
import "package:nexus/models/event.dart";
|
||||||
|
import "package:nexus/widgets/error_dialog.dart";
|
||||||
import "package:nexus/widgets/lazy_loading/message_displayname.dart";
|
import "package:nexus/widgets/lazy_loading/message_displayname.dart";
|
||||||
import "package:nexus/widgets/renderers/message.dart";
|
import "package:nexus/widgets/renderers/message.dart";
|
||||||
import "package:nexus/widgets/reaction_row.dart";
|
import "package:nexus/widgets/reaction_row.dart";
|
||||||
|
|
@ -49,9 +50,13 @@ class EventRenderer extends ConsumerWidget {
|
||||||
final child = event.redactedBy != null || event.relationType == "m.replace"
|
final child = event.redactedBy != null || event.relationType == "m.replace"
|
||||||
? null
|
? null
|
||||||
: switch (event.content) {
|
: switch (event.content) {
|
||||||
Content(:final parseError?) => SelectableText(
|
Content(:final parseError?) => Row(
|
||||||
"An error occurred while parsing this event:\n$parseError\n${parseError.stackTrace}",
|
children: [
|
||||||
style: errorStyle,
|
ErrorDialog(
|
||||||
|
"An error occurred while parsing event ${event.eventId}:\n$parseError",
|
||||||
|
parseError.stackTrace,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
MessageContent() ||
|
MessageContent() ||
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue