Browse Source

neon: Always print stack traces on error

pull/142/head
jld3103 2 years ago
parent
commit
7bdf8ea2b0
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 4
      packages/neon/lib/src/apps/files/blocs/files.dart
  2. 6
      packages/neon/lib/src/blocs/login.dart
  3. 3
      packages/neon/lib/src/pages/home.dart
  4. 4
      packages/neon/lib/src/pages/settings.dart
  5. 15
      packages/neon/lib/src/utils/request_manager.dart

4
packages/neon/lib/src/apps/files/blocs/files.dart

@ -194,7 +194,9 @@ class FilesBloc extends $FilesBloc {
await _downloadQueue.add(() => task.execute(client, sink));
_downloadTasksSubject.add(_downloadTasksSubject.value..removeWhere((final t) => t == task));
await sink.close();
} catch (e) {
} catch (e, s) {
debugPrint(e.toString());
debugPrint(s.toString());
await sink.close();
rethrow;
}

6
packages/neon/lib/src/blocs/login.dart

@ -56,12 +56,14 @@ class LoginBloc extends $LoginBloc {
final result = await client.core.getLoginFlowResult(token: init.poll.token);
_cancelPollTimer();
_loginFlowResultSubject.add(result);
} catch (e) {
} catch (e, s) {
debugPrint(e.toString());
debugPrint(s.toString());
}
});
} catch (e) {
} catch (e, s) {
debugPrint(e.toString());
debugPrint(s.toString());
_serverConnectionStateSubject.add(ServerConnectionState.unreachable);
}
}

3
packages/neon/lib/src/pages/home.dart

@ -95,8 +95,9 @@ class _HomePageState extends State<HomePage> {
AppLocalizations.of(context).errorServerInMaintenanceMode,
);
}
} catch (e) {
} catch (e, s) {
debugPrint(e.toString());
debugPrint(s.toString());
ExceptionWidget.showSnackbar(context, e);
}
}

4
packages/neon/lib/src/pages/settings.dart

@ -259,7 +259,7 @@ class _SettingsPageState extends State<SettingsPage> {
await saveFileWithPickDialog(fileName, Uint8List.fromList(utf8.encode(data)));
} catch (e, s) {
debugPrint(e.toString());
debugPrintStack(stackTrace: s);
debugPrint(s.toString());
ExceptionWidget.showSnackbar(context, e);
}
},
@ -295,7 +295,7 @@ class _SettingsPageState extends State<SettingsPage> {
await settingsExportHelper.applyFromJson(data as Map<String, dynamic>);
} catch (e, s) {
debugPrint(e.toString());
debugPrintStack(stackTrace: s);
debugPrint(s.toString());
ExceptionWidget.showSnackbar(context, e);
}
},

15
packages/neon/lib/src/utils/request_manager.dart

@ -14,8 +14,9 @@ class RequestManager {
yield Result.loading();
try {
yield Result.success(await _timeout(disableTimeout, call));
} on Exception catch (e) {
} on Exception catch (e, s) {
debugPrint(e.toString());
debugPrint(s.toString());
yield Result.error(e);
}
}
@ -39,8 +40,9 @@ class RequestManager {
if (cache != null && await cache!.has(key)) {
try {
yield ResultCached(unwrap(deserialize<R>(json.decode((await cache!.get(key))!))), loading: true);
} catch (e) {
} catch (e, s) {
debugPrint(e.toString());
debugPrint(s.toString());
}
}
@ -48,17 +50,18 @@ class RequestManager {
final response = await _timeout(disableTimeout, call);
await cache?.set(key, json.encode(serialize<R>(response)));
yield Result.success(unwrap(response));
} on Exception catch (e) {
} on Exception catch (e, s) {
debugPrint(e.toString());
debugPrint(s.toString());
if (cache != null && await cache!.has(key)) {
debugPrint(e.toString());
try {
yield ResultCached(unwrap(deserialize<R>(json.decode((await cache!.get(key))!))), loading: true);
return;
} catch (e) {
} catch (e, s) {
debugPrint(e.toString());
debugPrint(s.toString());
}
}
debugPrint(e.toString());
yield Result.error(e);
}
}

Loading…
Cancel
Save