diff options
| author | cyan <cyjan@mrcyjanek.net> | 2024-09-05 10:14:55 +0000 |
|---|---|---|
| committer | cyan <cyjan@mrcyjanek.net> | 2024-09-05 10:14:55 +0000 |
| commit | 777db7f93338dfa52c1fd56064f8807c14f91766 (patch) | |
| tree | d123816ee4d8cb50e2a2fb7f9caff543df5872d2 | |
| parent | fca0c1ec5cc735b550fb55c44040b08e084b566a (diff) | |
ignore errors in default debug functionscyjan-fix-debugCallLength-memory
| -rw-r--r-- | impls/monero.dart/lib/monero.dart | 24 | ||||
| -rw-r--r-- | impls/monero.dart/lib/wownero.dart | 24 |
2 files changed, 28 insertions, 20 deletions
diff --git a/impls/monero.dart/lib/monero.dart b/impls/monero.dart/lib/monero.dart index ab4210e..4fcc970 100644 --- a/impls/monero.dart/lib/monero.dart +++ b/impls/monero.dart/lib/monero.dart @@ -101,9 +101,11 @@ final Stopwatch sw = Stopwatch()..start(); bool printStarts = false; void Function(String call)? debugStart = (call) { - if (printStarts) print("MONERO: $call"); - debugCallLength[call] ??= <int>[]; - debugCallLength[call]!.add(sw.elapsedMicroseconds); + try { + if (printStarts) print("MONERO: $call"); + debugCallLength[call] ??= <int>[]; + debugCallLength[call]!.add(sw.elapsedMicroseconds); + } catch (e) {} }; void debugChores() { for (var key in debugCallLength.keys) { @@ -120,13 +122,15 @@ void debugChores() { int debugCount = 0; void Function(String call)? debugEnd = (call) { - final id = debugCallLength[call]!.length - 1; - if (++debugCount > 1000000) { - debugCount = 0; - debugChores(); - } - debugCallLength[call]![id] = - sw.elapsedMicroseconds - debugCallLength[call]![id]; + try { + final id = debugCallLength[call]!.length - 1; + if (++debugCount > 1000000) { + debugCount = 0; + debugChores(); + } + debugCallLength[call]![id] = + sw.elapsedMicroseconds - debugCallLength[call]![id]; + } catch (e) {} }; void Function(String call, dynamic error)? errorHandler = (call, error) { print("$call: $error"); diff --git a/impls/monero.dart/lib/wownero.dart b/impls/monero.dart/lib/wownero.dart index 9e2cb3b..d355005 100644 --- a/impls/monero.dart/lib/wownero.dart +++ b/impls/monero.dart/lib/wownero.dart @@ -101,9 +101,11 @@ final Stopwatch sw = Stopwatch()..start(); bool printStarts = false; void Function(String call)? debugStart = (call) { - if (printStarts) print("MONERO: $call"); - debugCallLength[call] ??= <int>[]; - debugCallLength[call]!.add(sw.elapsedMicroseconds); + try { + if (printStarts) print("MONERO: $call"); + debugCallLength[call] ??= <int>[]; + debugCallLength[call]!.add(sw.elapsedMicroseconds); + } catch (e) {} }; void debugChores() { for (var key in debugCallLength.keys) { @@ -120,13 +122,15 @@ void debugChores() { int debugCount = 0; void Function(String call)? debugEnd = (call) { - final id = debugCallLength[call]!.length - 1; - if (++debugCount > 1000000) { - debugCount = 0; - debugChores(); - } - debugCallLength[call]![id] = - sw.elapsedMicroseconds - debugCallLength[call]![id]; + try { + final id = debugCallLength[call]!.length - 1; + if (++debugCount > 1000000) { + debugCount = 0; + debugChores(); + } + debugCallLength[call]![id] = + sw.elapsedMicroseconds - debugCallLength[call]![id]; + } catch (e) {} }; void Function(String call, dynamic error)? errorHandler = (call, error) { print("$call: $error"); |
