Gallery: log failures in loadFiles method

This commit is contained in:
Neeraj Gupta 2021-09-14 12:16:07 +05:30
parent 6d8a47c9f0
commit c7da836656
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1

View file

@ -100,11 +100,18 @@ class _GalleryState extends State<Gallery> {
Future<FileLoadResult> _loadFiles({int limit}) async { Future<FileLoadResult> _loadFiles({int limit}) async {
_logger.info("Loading files"); _logger.info("Loading files");
final startTime = DateTime.now().microsecondsSinceEpoch; try {
final startTime = DateTime
.now()
.microsecondsSinceEpoch;
final result = await widget.asyncLoader( final result = await widget.asyncLoader(
kGalleryLoadStartTime, DateTime.now().microsecondsSinceEpoch, kGalleryLoadStartTime, DateTime
.now()
.microsecondsSinceEpoch,
limit: limit); limit: limit);
final endTime = DateTime.now().microsecondsSinceEpoch; final endTime = DateTime
.now()
.microsecondsSinceEpoch;
final duration = Duration(microseconds: endTime - startTime); final duration = Duration(microseconds: endTime - startTime);
_logger.info("Time taken to load " + _logger.info("Time taken to load " +
result.files.length.toString() + result.files.length.toString() +
@ -112,6 +119,10 @@ class _GalleryState extends State<Gallery> {
duration.inMilliseconds.toString() + duration.inMilliseconds.toString() +
"ms"); "ms");
return result; return result;
} catch(e, s) {
_logger.severe("failed to load files", e, s);
rethrow;
}
} }
// Collates files and returns `true` if it resulted in a gallery reload // Collates files and returns `true` if it resulted in a gallery reload