simplified platform exception reporting

This commit is contained in:
Thibault Deckers 2021-08-09 19:32:32 +09:00
parent 2684981765
commit ffc7643adf
15 changed files with 144 additions and 148 deletions

View file

@ -21,8 +21,8 @@ class AndroidAppService {
kakaoTalk.ownedDirs.add('KakaoTalkDownload'); kakaoTalk.ownedDirs.add('KakaoTalkDownload');
} }
return packages; return packages;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getPackages', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -34,8 +34,8 @@ class AndroidAppService {
'sizeDip': size, 'sizeDip': size,
}); });
if (result != null) return result as Uint8List; if (result != null) return result as Uint8List;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getAppIcon', e); await reportService.recordError(e, stack);
} }
return Uint8List(0); return Uint8List(0);
} }
@ -47,8 +47,8 @@ class AndroidAppService {
'label': label, 'label': label,
}); });
if (result != null) return result as bool; if (result != null) return result as bool;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('copyToClipboard', e); await reportService.recordError(e, stack);
} }
return false; return false;
} }
@ -60,8 +60,8 @@ class AndroidAppService {
'mimeType': mimeType, 'mimeType': mimeType,
}); });
if (result != null) return result as bool; if (result != null) return result as bool;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('edit', e); await reportService.recordError(e, stack);
} }
return false; return false;
} }
@ -73,8 +73,8 @@ class AndroidAppService {
'mimeType': mimeType, 'mimeType': mimeType,
}); });
if (result != null) return result as bool; if (result != null) return result as bool;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('open', e); await reportService.recordError(e, stack);
} }
return false; return false;
} }
@ -89,8 +89,8 @@ class AndroidAppService {
'geoUri': geoUri, 'geoUri': geoUri,
}); });
if (result != null) return result as bool; if (result != null) return result as bool;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('openMap', e); await reportService.recordError(e, stack);
} }
return false; return false;
} }
@ -102,8 +102,8 @@ class AndroidAppService {
'mimeType': mimeType, 'mimeType': mimeType,
}); });
if (result != null) return result as bool; if (result != null) return result as bool;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('setAs', e); await reportService.recordError(e, stack);
} }
return false; return false;
} }
@ -117,8 +117,8 @@ class AndroidAppService {
'urisByMimeType': urisByMimeType, 'urisByMimeType': urisByMimeType,
}); });
if (result != null) return result as bool; if (result != null) return result as bool;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('shareEntries', e); await reportService.recordError(e, stack);
} }
return false; return false;
} }
@ -131,8 +131,8 @@ class AndroidAppService {
}, },
}); });
if (result != null) return result as bool; if (result != null) return result as bool;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('shareSingle', e); await reportService.recordError(e, stack);
} }
return false; return false;
} }

View file

@ -9,40 +9,40 @@ class AndroidDebugService {
static Future<void> crash() async { static Future<void> crash() async {
try { try {
await platform.invokeMethod('crash'); await platform.invokeMethod('crash');
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('crash', e); await reportService.recordError(e, stack);
} }
} }
static Future<void> exception() async { static Future<void> exception() async {
try { try {
await platform.invokeMethod('exception'); await platform.invokeMethod('exception');
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('exception', e); await reportService.recordError(e, stack);
} }
} }
static Future<void> safeException() async { static Future<void> safeException() async {
try { try {
await platform.invokeMethod('safeException'); await platform.invokeMethod('safeException');
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('safeException', e); await reportService.recordError(e, stack);
} }
} }
static Future<void> exceptionInCoroutine() async { static Future<void> exceptionInCoroutine() async {
try { try {
await platform.invokeMethod('exceptionInCoroutine'); await platform.invokeMethod('exceptionInCoroutine');
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('exceptionInCoroutine', e); await reportService.recordError(e, stack);
} }
} }
static Future<void> safeExceptionInCoroutine() async { static Future<void> safeExceptionInCoroutine() async {
try { try {
await platform.invokeMethod('safeExceptionInCoroutine'); await platform.invokeMethod('safeExceptionInCoroutine');
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('safeExceptionInCoroutine', e); await reportService.recordError(e, stack);
} }
} }
@ -50,8 +50,8 @@ class AndroidDebugService {
try { try {
final result = await platform.invokeMethod('getContextDirs'); final result = await platform.invokeMethod('getContextDirs');
if (result != null) return result as Map; if (result != null) return result as Map;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getContextDirs', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -60,8 +60,8 @@ class AndroidDebugService {
try { try {
final result = await platform.invokeMethod('getEnv'); final result = await platform.invokeMethod('getEnv');
if (result != null) return result as Map; if (result != null) return result as Map;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getEnv', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -73,8 +73,8 @@ class AndroidDebugService {
'uri': entry.uri, 'uri': entry.uri,
}); });
if (result != null) return result as Map; if (result != null) return result as Map;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getBitmapFactoryInfo', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -87,8 +87,8 @@ class AndroidDebugService {
'uri': entry.uri, 'uri': entry.uri,
}); });
if (result != null) return result as Map; if (result != null) return result as Map;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getContentResolverMetadata', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -102,8 +102,8 @@ class AndroidDebugService {
'sizeBytes': entry.sizeBytes, 'sizeBytes': entry.sizeBytes,
}); });
if (result != null) return result as Map; if (result != null) return result as Map;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getExifInterfaceMetadata', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -115,8 +115,8 @@ class AndroidDebugService {
'uri': entry.uri, 'uri': entry.uri,
}); });
if (result != null) return result as Map; if (result != null) return result as Map;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getMediaMetadataRetrieverMetadata', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -130,8 +130,8 @@ class AndroidDebugService {
'sizeBytes': entry.sizeBytes, 'sizeBytes': entry.sizeBytes,
}); });
if (result != null) return result as Map; if (result != null) return result as Map;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getMetadataExtractorSummary', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -144,8 +144,8 @@ class AndroidDebugService {
'uri': entry.uri, 'uri': entry.uri,
}); });
if (result != null) return result as Map; if (result != null) return result as Map;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getTiffStructure', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }

View file

@ -23,8 +23,8 @@ class AppShortcutService {
_canPin = result; _canPin = result;
return result; return result;
} }
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('canPin', e); await reportService.recordError(e, stack);
} }
return false; return false;
} }
@ -49,8 +49,8 @@ class AppShortcutService {
'iconBytes': iconBytes, 'iconBytes': iconBytes,
'filters': filters.map((filter) => filter.toJson()).toList(), 'filters': filters.map((filter) => filter.toJson()).toList(),
}); });
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('pin', e); await reportService.recordError(e, stack);
} }
} }
} }

View file

@ -9,8 +9,8 @@ class DeviceService {
await platform.invokeMethod('getPerformanceClass'); await platform.invokeMethod('getPerformanceClass');
final result = await platform.invokeMethod('getPerformanceClass'); final result = await platform.invokeMethod('getPerformanceClass');
if (result != null) return result as int; if (result != null) return result as int;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getPerformanceClass', e); await reportService.recordError(e, stack);
} }
return 0; return 0;
} }

View file

@ -26,8 +26,8 @@ class PlatformEmbeddedDataService implements EmbeddedDataService {
'sizeBytes': entry.sizeBytes, 'sizeBytes': entry.sizeBytes,
}); });
if (result != null) return (result as List).cast<Uint8List>(); if (result != null) return (result as List).cast<Uint8List>();
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getExifThumbnail', e); await reportService.recordError(e, stack);
} }
return []; return [];
} }
@ -42,8 +42,8 @@ class PlatformEmbeddedDataService implements EmbeddedDataService {
'displayName': '${entry.bestTitle} • Video', 'displayName': '${entry.bestTitle} • Video',
}); });
if (result != null) return result as Map; if (result != null) return result as Map;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('extractMotionPhotoVideo', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -56,8 +56,8 @@ class PlatformEmbeddedDataService implements EmbeddedDataService {
'displayName': '${entry.bestTitle} • Cover', 'displayName': '${entry.bestTitle} • Cover',
}); });
if (result != null) return result as Map; if (result != null) return result as Map;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('extractVideoEmbeddedPicture', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -74,8 +74,8 @@ class PlatformEmbeddedDataService implements EmbeddedDataService {
'propMimeType': propMimeType, 'propMimeType': propMimeType,
}); });
if (result != null) return result as Map; if (result != null) return result as Map;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('extractXmpDataProp', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }

View file

@ -20,8 +20,8 @@ class GeocodingService {
'maxResults': 2, 'maxResults': 2,
}); });
return (result as List).cast<Map>().map((map) => Address.fromMap(map)).toList(); return (result as List).cast<Map>().map((map) => Address.fromMap(map)).toList();
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getAddress', e); await reportService.recordError(e, stack);
} }
return []; return [];
} }

View file

@ -14,8 +14,8 @@ class GlobalSearch {
await platform.invokeMethod('registerCallback', <String, dynamic>{ await platform.invokeMethod('registerCallback', <String, dynamic>{
'callbackHandle': PluginUtilities.getCallbackHandle(_init)?.toRawHandle(), 'callbackHandle': PluginUtilities.getCallbackHandle(_init)?.toRawHandle(),
}); });
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('registerCallback', e); await reportService.recordError(e, stack);
} }
} }
} }

View file

@ -124,8 +124,8 @@ class PlatformImageFileService implements ImageFileService {
'mimeType': mimeType, 'mimeType': mimeType,
}) as Map; }) as Map;
return AvesEntry.fromMap(result); return AvesEntry.fromMap(result);
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getEntry', e); await reportService.recordError(e, stack);
} }
return null; return null;
} }
@ -188,8 +188,8 @@ class PlatformImageFileService implements ImageFileService {
cancelOnError: true, cancelOnError: true,
); );
return completer.future; return completer.future;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
reportService.recordChannelError('getImage', e); reportService.recordError(e, stack);
} }
return Future.sync(() => Uint8List(0)); return Future.sync(() => Uint8List(0));
} }
@ -223,8 +223,8 @@ class PlatformImageFileService implements ImageFileService {
'imageHeight': imageSize.height.toInt(), 'imageHeight': imageSize.height.toInt(),
}); });
if (result != null) return result as Uint8List; if (result != null) return result as Uint8List;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getRegion', e); await reportService.recordError(e, stack);
} }
return Uint8List(0); return Uint8List(0);
}, },
@ -260,8 +260,8 @@ class PlatformImageFileService implements ImageFileService {
'defaultSizeDip': thumbnailDefaultSize, 'defaultSizeDip': thumbnailDefaultSize,
}); });
if (result != null) return result as Uint8List; if (result != null) return result as Uint8List;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getThumbnail', e); await reportService.recordError(e, stack);
} }
return Uint8List(0); return Uint8List(0);
}, },
@ -274,8 +274,8 @@ class PlatformImageFileService implements ImageFileService {
Future<void> clearSizedThumbnailDiskCache() async { Future<void> clearSizedThumbnailDiskCache() async {
try { try {
return platform.invokeMethod('clearSizedThumbnailDiskCache'); return platform.invokeMethod('clearSizedThumbnailDiskCache');
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('clearSizedThumbnailDiskCache', e); await reportService.recordError(e, stack);
} }
} }
@ -295,8 +295,8 @@ class PlatformImageFileService implements ImageFileService {
'op': 'delete', 'op': 'delete',
'entries': entries.map(_toPlatformEntryMap).toList(), 'entries': entries.map(_toPlatformEntryMap).toList(),
}).map((event) => ImageOpEvent.fromMap(event)); }).map((event) => ImageOpEvent.fromMap(event));
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
reportService.recordChannelError('delete', e); reportService.recordError(e, stack);
return Stream.error(e); return Stream.error(e);
} }
} }
@ -314,8 +314,8 @@ class PlatformImageFileService implements ImageFileService {
'copy': copy, 'copy': copy,
'destinationPath': destinationAlbum, 'destinationPath': destinationAlbum,
}).map((event) => MoveOpEvent.fromMap(event)); }).map((event) => MoveOpEvent.fromMap(event));
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
reportService.recordChannelError('move', e); reportService.recordError(e, stack);
return Stream.error(e); return Stream.error(e);
} }
} }
@ -333,8 +333,8 @@ class PlatformImageFileService implements ImageFileService {
'mimeType': mimeType, 'mimeType': mimeType,
'destinationPath': destinationAlbum, 'destinationPath': destinationAlbum,
}).map((event) => ExportOpEvent.fromMap(event)); }).map((event) => ExportOpEvent.fromMap(event));
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
reportService.recordChannelError('export', e); reportService.recordError(e, stack);
return Stream.error(e); return Stream.error(e);
} }
} }
@ -356,8 +356,8 @@ class PlatformImageFileService implements ImageFileService {
'destinationPath': destinationAlbum, 'destinationPath': destinationAlbum,
}); });
if (result != null) return (result as Map).cast<String, dynamic>(); if (result != null) return (result as Map).cast<String, dynamic>();
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('captureFrame', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -371,8 +371,8 @@ class PlatformImageFileService implements ImageFileService {
'newName': newName, 'newName': newName,
}); });
if (result != null) return (result as Map).cast<String, dynamic>(); if (result != null) return (result as Map).cast<String, dynamic>();
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('rename', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -386,8 +386,8 @@ class PlatformImageFileService implements ImageFileService {
'clockwise': clockwise, 'clockwise': clockwise,
}); });
if (result != null) return (result as Map).cast<String, dynamic>(); if (result != null) return (result as Map).cast<String, dynamic>();
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('rotate', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -400,8 +400,8 @@ class PlatformImageFileService implements ImageFileService {
'entry': _toPlatformEntryMap(entry), 'entry': _toPlatformEntryMap(entry),
}); });
if (result != null) return (result as Map).cast<String, dynamic>(); if (result != null) return (result as Map).cast<String, dynamic>();
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('flip', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }

View file

@ -25,8 +25,8 @@ class PlatformMediaStoreService implements MediaStoreService {
'knownContentIds': knownContentIds, 'knownContentIds': knownContentIds,
}); });
return (result as List).cast<int>(); return (result as List).cast<int>();
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('checkObsoleteContentIds', e); await reportService.recordError(e, stack);
} }
return []; return [];
} }
@ -38,8 +38,8 @@ class PlatformMediaStoreService implements MediaStoreService {
'knownPathById': knownPathById, 'knownPathById': knownPathById,
}); });
return (result as List).cast<int>(); return (result as List).cast<int>();
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('checkObsoletePaths', e); await reportService.recordError(e, stack);
} }
return []; return [];
} }
@ -50,8 +50,8 @@ class PlatformMediaStoreService implements MediaStoreService {
return _streamChannel.receiveBroadcastStream(<String, dynamic>{ return _streamChannel.receiveBroadcastStream(<String, dynamic>{
'knownEntries': knownEntries, 'knownEntries': knownEntries,
}).map((event) => AvesEntry.fromMap(event)); }).map((event) => AvesEntry.fromMap(event));
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
reportService.recordChannelError('getEntries', e); reportService.recordError(e, stack);
return Stream.error(e); return Stream.error(e);
} }
} }

View file

@ -35,8 +35,8 @@ class PlatformMetadataService implements MetadataService {
'sizeBytes': entry.sizeBytes, 'sizeBytes': entry.sizeBytes,
}); });
if (result != null) return result as Map; if (result != null) return result as Map;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getAllMetadata', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -65,8 +65,8 @@ class PlatformMetadataService implements MetadataService {
}) as Map; }) as Map;
result['contentId'] = entry.contentId; result['contentId'] = entry.contentId;
return CatalogMetadata.fromMap(result); return CatalogMetadata.fromMap(result);
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getCatalogMetadata', e); await reportService.recordError(e, stack);
} }
return null; return null;
} }
@ -91,8 +91,8 @@ class PlatformMetadataService implements MetadataService {
'sizeBytes': entry.sizeBytes, 'sizeBytes': entry.sizeBytes,
}) as Map; }) as Map;
return OverlayMetadata.fromMap(result); return OverlayMetadata.fromMap(result);
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getOverlayMetadata', e); await reportService.recordError(e, stack);
} }
return null; return null;
} }
@ -113,8 +113,8 @@ class PlatformMetadataService implements MetadataService {
imagePage['rotationDegrees'] = entry.rotationDegrees; imagePage['rotationDegrees'] = entry.rotationDegrees;
} }
return MultiPageInfo.fromPageMaps(entry, pageMaps); return MultiPageInfo.fromPageMaps(entry, pageMaps);
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getMultiPageInfo', e); await reportService.recordError(e, stack);
} }
return null; return null;
} }
@ -131,8 +131,8 @@ class PlatformMetadataService implements MetadataService {
'sizeBytes': entry.sizeBytes, 'sizeBytes': entry.sizeBytes,
}) as Map; }) as Map;
return PanoramaInfo.fromMap(result); return PanoramaInfo.fromMap(result);
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('PanoramaInfo', e); await reportService.recordError(e, stack);
} }
return null; return null;
} }
@ -145,8 +145,8 @@ class PlatformMetadataService implements MetadataService {
'uri': entry.uri, 'uri': entry.uri,
'prop': prop, 'prop': prop,
}); });
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getContentResolverProp', e); await reportService.recordError(e, stack);
} }
return null; return null;
} }

View file

@ -16,10 +16,6 @@ abstract class ReportService {
Future<void> recordError(dynamic exception, StackTrace? stack); Future<void> recordError(dynamic exception, StackTrace? stack);
Future<void> recordFlutterError(FlutterErrorDetails flutterErrorDetails); Future<void> recordFlutterError(FlutterErrorDetails flutterErrorDetails);
Future<void> recordChannelError(String method, PlatformException e) {
return recordError('$method failed with code=${e.code}, exception=${e.message}, details=${e.details}}', null);
}
} }
class CrashlyticsReportService extends ReportService { class CrashlyticsReportService extends ReportService {

View file

@ -47,8 +47,8 @@ class PlatformStorageService implements StorageService {
try { try {
final result = await platform.invokeMethod('getStorageVolumes'); final result = await platform.invokeMethod('getStorageVolumes');
return (result as List).cast<Map>().map((map) => StorageVolume.fromMap(map)).toSet(); return (result as List).cast<Map>().map((map) => StorageVolume.fromMap(map)).toSet();
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getStorageVolumes', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -60,8 +60,8 @@ class PlatformStorageService implements StorageService {
'path': volume.path, 'path': volume.path,
}); });
return result as int?; return result as int?;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getFreeSpace', e); await reportService.recordError(e, stack);
} }
return null; return null;
} }
@ -71,8 +71,8 @@ class PlatformStorageService implements StorageService {
try { try {
final result = await platform.invokeMethod('getGrantedDirectories'); final result = await platform.invokeMethod('getGrantedDirectories');
return (result as List).cast<String>(); return (result as List).cast<String>();
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getGrantedDirectories', e); await reportService.recordError(e, stack);
} }
return []; return [];
} }
@ -83,8 +83,8 @@ class PlatformStorageService implements StorageService {
await platform.invokeMethod('revokeDirectoryAccess', <String, dynamic>{ await platform.invokeMethod('revokeDirectoryAccess', <String, dynamic>{
'path': path, 'path': path,
}); });
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('revokeDirectoryAccess', e); await reportService.recordError(e, stack);
} }
return; return;
} }
@ -98,8 +98,8 @@ class PlatformStorageService implements StorageService {
if (result != null) { if (result != null) {
return (result as List).cast<Map>().map(VolumeRelativeDirectory.fromMap).toSet(); return (result as List).cast<Map>().map(VolumeRelativeDirectory.fromMap).toSet();
} }
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getInaccessibleDirectories', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -111,8 +111,8 @@ class PlatformStorageService implements StorageService {
if (result != null) { if (result != null) {
return (result as List).cast<Map>().map(VolumeRelativeDirectory.fromMap).toSet(); return (result as List).cast<Map>().map(VolumeRelativeDirectory.fromMap).toSet();
} }
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getRestrictedDirectories', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -134,8 +134,8 @@ class PlatformStorageService implements StorageService {
cancelOnError: true, cancelOnError: true,
); );
return completer.future; return completer.future;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('requestVolumeAccess', e); await reportService.recordError(e, stack);
} }
return false; return false;
} }
@ -148,8 +148,8 @@ class PlatformStorageService implements StorageService {
'dirPaths': dirPaths.toList(), 'dirPaths': dirPaths.toList(),
}); });
if (result != null) return result as int; if (result != null) return result as int;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('deleteEmptyDirectories', e); await reportService.recordError(e, stack);
} }
return 0; return 0;
} }
@ -164,8 +164,8 @@ class PlatformStorageService implements StorageService {
'mimeType': mimeType, 'mimeType': mimeType,
}); });
if (result != null) return Uri.tryParse(result); if (result != null) return Uri.tryParse(result);
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('scanFile', e); await reportService.recordError(e, stack);
} }
return null; return null;
} }
@ -188,8 +188,8 @@ class PlatformStorageService implements StorageService {
cancelOnError: true, cancelOnError: true,
); );
return completer.future; return completer.future;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('createFile', e); await reportService.recordError(e, stack);
} }
return false; return false;
} }
@ -215,8 +215,8 @@ class PlatformStorageService implements StorageService {
cancelOnError: true, cancelOnError: true,
); );
return completer.future; return completer.future;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('openFile', e); await reportService.recordError(e, stack);
} }
return Uint8List(0); return Uint8List(0);
} }
@ -236,8 +236,8 @@ class PlatformStorageService implements StorageService {
cancelOnError: true, cancelOnError: true,
); );
return completer.future; return completer.future;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('selectDirectory', e); await reportService.recordError(e, stack);
} }
return null; return null;
} }

View file

@ -12,8 +12,8 @@ class PlatformTimeService implements TimeService {
Future<String?> getDefaultTimeZone() async { Future<String?> getDefaultTimeZone() async {
try { try {
return await platform.invokeMethod('getDefaultTimeZone'); return await platform.invokeMethod('getDefaultTimeZone');
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getDefaultTimeZone', e); await reportService.recordError(e, stack);
} }
return null; return null;
} }

View file

@ -9,8 +9,8 @@ class ViewerService {
// returns nullable map with 'action' and possibly 'uri' 'mimeType' // returns nullable map with 'action' and possibly 'uri' 'mimeType'
final result = await platform.invokeMethod('getIntentData'); final result = await platform.invokeMethod('getIntentData');
if (result != null) return (result as Map).cast<String, dynamic>(); if (result != null) return (result as Map).cast<String, dynamic>();
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('getIntentData', e); await reportService.recordError(e, stack);
} }
return {}; return {};
} }
@ -20,8 +20,8 @@ class ViewerService {
await platform.invokeMethod('pick', <String, dynamic>{ await platform.invokeMethod('pick', <String, dynamic>{
'uri': uri, 'uri': uri,
}); });
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('pick', e); await reportService.recordError(e, stack);
} }
} }
} }

View file

@ -23,8 +23,8 @@ class PlatformWindowService implements WindowService {
await platform.invokeMethod('keepScreenOn', <String, dynamic>{ await platform.invokeMethod('keepScreenOn', <String, dynamic>{
'on': on, 'on': on,
}); });
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('keepScreenOn', e); await reportService.recordError(e, stack);
} }
} }
@ -33,8 +33,8 @@ class PlatformWindowService implements WindowService {
try { try {
final result = await platform.invokeMethod('isRotationLocked'); final result = await platform.invokeMethod('isRotationLocked');
if (result != null) return result as bool; if (result != null) return result as bool;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('isRotationLocked', e); await reportService.recordError(e, stack);
} }
return false; return false;
} }
@ -61,8 +61,8 @@ class PlatformWindowService implements WindowService {
await platform.invokeMethod('requestOrientation', <String, dynamic>{ await platform.invokeMethod('requestOrientation', <String, dynamic>{
'orientation': orientationCode, 'orientation': orientationCode,
}); });
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('requestOrientation', e); await reportService.recordError(e, stack);
} }
} }
@ -71,8 +71,8 @@ class PlatformWindowService implements WindowService {
try { try {
final result = await platform.invokeMethod('canSetCutoutMode'); final result = await platform.invokeMethod('canSetCutoutMode');
if (result != null) return result as bool; if (result != null) return result as bool;
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('canSetCutoutMode', e); await reportService.recordError(e, stack);
} }
return false; return false;
} }
@ -83,8 +83,8 @@ class PlatformWindowService implements WindowService {
await platform.invokeMethod('setCutoutMode', <String, dynamic>{ await platform.invokeMethod('setCutoutMode', <String, dynamic>{
'use': use, 'use': use,
}); });
} on PlatformException catch (e) { } on PlatformException catch (e, stack) {
await reportService.recordChannelError('setCutoutMode', e); await reportService.recordError(e, stack);
} }
} }
} }