Skip to content

Commit 6e5d454

Browse files
gnpricechrisbobbe
authored andcommitted
log: Report stack trace on registerQueue failure, in debug
For a malformed-response error this is essential because it pinpoints where in the data schema the mismatch occurred between our expectations and the server's behavior. There's more to do here (#890 for getting this to the user in cases like a malformed response, so they can screenshot it when reporting an issue; #1083 for including stack traces when relevant in showing other errors to the user) but this is a start.
1 parent 6bafd23 commit 6e5d454

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/model/store.dart

+6-3
Original file line numberDiff line numberDiff line change
@@ -906,9 +906,12 @@ class UpdateMachine {
906906
while (true) {
907907
try {
908908
return await registerQueue(connection);
909-
} catch (e) {
910-
assert(debugLog('Error fetching initial snapshot: $e\n'
911-
'Backing off, then will retry…'));
909+
} catch (e, s) {
910+
assert(debugLog('Error fetching initial snapshot: $e'));
911+
// Print stack trace in its own log entry; log entries are truncated
912+
// at 1 kiB (at least on Android), and stack can be longer than that.
913+
assert(debugLog('Stack:\n$s'));
914+
assert(debugLog('Backing off, then will retry…'));
912915
// TODO tell user if initial-fetch errors persist, or look non-transient
913916
await (backoffMachine ??= BackoffMachine()).wait();
914917
assert(debugLog('… Backoff wait complete, retrying initial fetch.'));

0 commit comments

Comments
 (0)