Browse Source

added error log for exception while reading time.

pull/3/head
Herbert Poul 4 years ago
parent
commit
33342f3283
  1. 10
      lib/src/kdbx_xml.dart

10
lib/src/kdbx_xml.dart

@ -10,6 +10,10 @@ import 'package:kdbx/src/kdbx_consts.dart';
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'package:xml/xml.dart'; import 'package:xml/xml.dart';
import 'package:logging/logging.dart';
final _logger = Logger('kdbx_xml');
class KdbxXml { class KdbxXml {
static const NODE_STRING = 'String'; static const NODE_STRING = 'String';
static const NODE_KEY = 'Key'; static const NODE_KEY = 'Key';
@ -250,6 +254,7 @@ class DateTimeUtcNode extends KdbxSubTextNode<DateTime> {
if (value == null) { if (value == null) {
return null; return null;
} }
try {
if (value.contains(':')) { if (value.contains(':')) {
return DateTime.parse(value); return DateTime.parse(value);
} }
@ -261,6 +266,11 @@ class DateTimeUtcNode extends KdbxSubTextNode<DateTime> {
return DateTime.fromMillisecondsSinceEpoch( return DateTime.fromMillisecondsSinceEpoch(
(secondsFrom00 - EpochSeconds) * 1000, (secondsFrom00 - EpochSeconds) * 1000,
isUtc: true); isUtc: true);
} catch (e, stackTrace) {
_logger.severe(
'Error while parsing time for {$name}: {$value}', e, stackTrace);
rethrow;
}
} }
@override @override

Loading…
Cancel
Save