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

Loading…
Cancel
Save