opt: enable debug stacktrace output & add json serde check

This commit is contained in:
Kingtous 2022-12-09 10:49:47 +08:00
parent d5a93adbf0
commit d3d4c7dac4
7 changed files with 22 additions and 20 deletions

View File

@ -1013,7 +1013,7 @@ class LastWindowPosition {
return LastWindowPosition(m["width"], m["height"], m["offsetWidth"],
m["offsetHeight"], m["isMaximized"]);
} catch (e) {
debugPrint(e.toString());
debugPrintStack(label: e.toString());
return null;
}
}
@ -1147,7 +1147,7 @@ Future<bool> restoreWindowPosition(WindowType type, {int? windowId}) async {
final pos = bind.getLocalFlutterConfig(k: kWindowPrefix + type.name);
var lpos = LastWindowPosition.loadFromString(pos);
if (lpos == null) {
debugPrint("window position saved, but cannot be parsed");
debugPrint("no window position saved, ignoring position restoration");
return false;
}
@ -1212,7 +1212,7 @@ Future<void> initUniLinks() async {
}
parseRustdeskUri(initialLink);
} catch (err) {
debugPrint("$err");
debugPrintStack(label: "$err");
}
}
@ -1422,7 +1422,7 @@ void onActiveWindowChanged() async {
rustDeskWinManager.closeAllSubWindows()
]);
} catch (err) {
debugPrint("$err");
debugPrintStack(label: "$err");
} finally {
await windowManager.setPreventClose(false);
await windowManager.close();

View File

@ -79,16 +79,19 @@ class _PeerTabPageState extends State<PeerTabPage>
.toList()
.obs;
try {
final json = jsonDecode(bind.getLocalFlutterConfig(k: 'peer-tab-order'));
if (json is List) {
final List<String> list = json.map((e) => e.toString()).toList();
if (list.length == visibleOrderedTabs.length &&
visibleOrderedTabs.every((e) => list.contains(e))) {
visibleOrderedTabs.value = list;
final conf = bind.getLocalFlutterConfig(k: 'peer-tab-order');
if (conf.isNotEmpty) {
final json = jsonDecode(conf);
if (json is List) {
final List<String> list = json.map((e) => e.toString()).toList();
if (list.length == visibleOrderedTabs.length &&
visibleOrderedTabs.every((e) => list.contains(e))) {
visibleOrderedTabs.value = list;
}
}
}
} catch (e) {
debugPrint('$e');
debugPrintStack(label: '$e');
}
adjustTab();

View File

@ -63,7 +63,7 @@ class DesktopSettingPage extends StatefulWidget {
DesktopTabPage.onAddSetting(initialPage: page);
}
} catch (e) {
debugPrint('$e');
debugPrintStack(label: '$e');
}
}
}

View File

@ -31,7 +31,7 @@ class DesktopTabPage extends StatefulWidget {
initialPage: initialPage,
)));
} catch (e) {
debugPrint('$e');
debugPrintStack(label: '$e');
}
}
}

View File

@ -460,7 +460,7 @@ Future<bool> loginDialog() async {
debugPrint('$resp');
completer.complete(true);
} catch (err) {
debugPrint(err.toString());
debugPrintStack(label: err.toString());
cancel();
return;
}

View File

@ -564,7 +564,7 @@ void androidChannelInit() {
}
}
} catch (e) {
debugPrint("MethodCallHandler err:$e");
debugPrintStack(label: "MethodCallHandler err:$e");
}
return "";
});

View File

@ -126,7 +126,7 @@ class PlatformFFI {
// no need to set home dir
}
} catch (e) {
debugPrint('initialize failed: $e');
debugPrintStack(label: 'initialize failed: $e');
}
String id = 'NA';
String name = 'Flutter';
@ -151,9 +151,8 @@ class PlatformFFI {
WindowsDeviceInfo winInfo = await deviceInfo.windowsInfo;
name = winInfo.computerName;
id = winInfo.computerName;
} catch (e, stacktrace) {
debugPrint("get windows device info failed: $e");
debugPrintStack(stackTrace: stacktrace);
} catch (e) {
debugPrintStack(label: "get windows device info failed: $e");
name = "unknown";
id = "unknown";
}
@ -174,7 +173,7 @@ class PlatformFFI {
await _ffiBind.mainSetHomeDir(home: _homeDir);
await _ffiBind.mainInit(appDir: _dir);
} catch (e) {
debugPrint('initialize failed: $e');
debugPrintStack(label: 'initialize failed: $e');
}
version = await getVersion();
}