Skip to content

Commit 7fac9ea

Browse files
committed
Rename SyncStatus.exception -> SyncStatus.anyError.
1 parent 9fe1e74 commit 7fac9ea

File tree

4 files changed

+16
-26
lines changed

4 files changed

+16
-26
lines changed

demos/supabase-anonymous-auth/lib/widgets/status_app_bar.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ Widget _makeIcon(String text, IconData icon) {
6161
}
6262

6363
Widget _getStatusIcon(SyncStatus status) {
64-
if (status.exception != null) {
65-
// The exception message is verbose, could be replaced with something
64+
if (status.anyError != null) {
65+
// The error message is verbose, could be replaced with something
6666
// more user-friendly
6767
if (!status.connected) {
68-
return _makeIcon(status.exception!.toString(), Icons.cloud_off);
68+
return _makeIcon(status.anyError!.toString(), Icons.cloud_off);
6969
} else {
70-
return _makeIcon(status.exception!.toString(), Icons.sync_problem);
70+
return _makeIcon(status.anyError!.toString(), Icons.sync_problem);
7171
}
7272
} else if (status.connecting) {
7373
return _makeIcon('Connecting', Icons.cloud_sync_outlined);

demos/supabase-edge-function-auth/lib/widgets/status_app_bar.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ Widget _makeIcon(String text, IconData icon) {
6161
}
6262

6363
Widget _getStatusIcon(SyncStatus status) {
64-
if (status.exception != null) {
65-
// The exception message is verbose, could be replaced with something
64+
if (status.anyError != null) {
65+
// The error message is verbose, could be replaced with something
6666
// more user-friendly
6767
if (!status.connected) {
68-
return _makeIcon(status.exception!.toString(), Icons.cloud_off);
68+
return _makeIcon(status.anyError!.toString(), Icons.cloud_off);
6969
} else {
70-
return _makeIcon(status.exception!.toString(), Icons.sync_problem);
70+
return _makeIcon(status.anyError!.toString(), Icons.sync_problem);
7171
}
7272
} else if (status.connecting) {
7373
return _makeIcon('Connecting', Icons.cloud_sync_outlined);

demos/supabase-todolist/lib/widgets/status_app_bar.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ Widget _makeIcon(String text, IconData icon) {
6868
}
6969

7070
Widget _getStatusIcon(SyncStatus status) {
71-
if (status.exception != null) {
72-
// The exception message is verbose, could be replaced with something
71+
if (status.anyError != null) {
72+
// The error message is verbose, could be replaced with something
7373
// more user-friendly
7474
if (!status.connected) {
75-
return _makeIcon(status.exception!.toString(), Icons.cloud_off);
75+
return _makeIcon(status.anyError!.toString(), Icons.cloud_off);
7676
} else {
77-
return _makeIcon(status.exception!.toString(), Icons.sync_problem);
77+
return _makeIcon(status.anyError!.toString(), Icons.sync_problem);
7878
}
7979
} else if (status.connecting) {
8080
return _makeIcon('Connecting', Icons.cloud_sync_outlined);

packages/powersync/lib/src/sync_status.dart

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,9 @@ class SyncStatus {
5555
other.lastSyncedAt == lastSyncedAt);
5656
}
5757

58-
// Get the current [downloadError] or [uploadError] as an Exception;
59-
Exception? get exception {
60-
if (downloadError is Exception) {
61-
return downloadError as Exception;
62-
} else if (downloadError != null) {
63-
return Exception('Download error: $downloadError');
64-
} else if (uploadError is Exception) {
65-
return uploadError as Exception;
66-
} else if (uploadError != null) {
67-
return Exception('Upload error: $uploadError');
68-
} else {
69-
return null;
70-
}
58+
/// Get the current [downloadError] or [uploadError].
59+
Object? get anyError {
60+
return downloadError ?? uploadError;
7161
}
7262

7363
@override
@@ -78,7 +68,7 @@ class SyncStatus {
7868

7969
@override
8070
String toString() {
81-
return "SyncStatus<connected: $connected downloading: $downloading uploading: $uploading lastSyncedAt: $lastSyncedAt error: $exception>";
71+
return "SyncStatus<connected: $connected downloading: $downloading uploading: $uploading lastSyncedAt: $lastSyncedAt error: $anyError>";
8272
}
8373
}
8474

0 commit comments

Comments
 (0)