Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/lib/utils/platform/platform_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ class PlatformService {
/// Execute a future function only if the platform supports it
static Future<T?> executeIfSupportedAsync<T>(bool isSupported, Future<T> Function() function, {T? fallback}) async {
if (isSupported) {
return await function();
try {
return await function();
} on HandshakeException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While catching HandshakeException fixes the specific crash reported, it would be more robust to catch the more general IOException. This would handle other network-related errors as well, such as SocketException (e.g., no internet connection) or other I/O errors, which seems to align with the goal of gracefully handling "network issues" as mentioned in the test plan. HandshakeException itself is a subtype of IOException.

Suggested change
} on HandshakeException {
} on IOException {

return fallback;
}
}
return fallback;
}
Expand Down