simplified platform exception reporting
This commit is contained in:
parent
2684981765
commit
ffc7643adf
15 changed files with 144 additions and 148 deletions
|
@ -21,8 +21,8 @@ class AndroidAppService {
|
|||
kakaoTalk.ownedDirs.add('KakaoTalkDownload');
|
||||
}
|
||||
return packages;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getPackages', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ class AndroidAppService {
|
|||
'sizeDip': size,
|
||||
});
|
||||
if (result != null) return result as Uint8List;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getAppIcon', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return Uint8List(0);
|
||||
}
|
||||
|
@ -47,8 +47,8 @@ class AndroidAppService {
|
|||
'label': label,
|
||||
});
|
||||
if (result != null) return result as bool;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('copyToClipboard', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ class AndroidAppService {
|
|||
'mimeType': mimeType,
|
||||
});
|
||||
if (result != null) return result as bool;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('edit', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -73,8 +73,8 @@ class AndroidAppService {
|
|||
'mimeType': mimeType,
|
||||
});
|
||||
if (result != null) return result as bool;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('open', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -89,8 +89,8 @@ class AndroidAppService {
|
|||
'geoUri': geoUri,
|
||||
});
|
||||
if (result != null) return result as bool;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('openMap', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -102,8 +102,8 @@ class AndroidAppService {
|
|||
'mimeType': mimeType,
|
||||
});
|
||||
if (result != null) return result as bool;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('setAs', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -117,8 +117,8 @@ class AndroidAppService {
|
|||
'urisByMimeType': urisByMimeType,
|
||||
});
|
||||
if (result != null) return result as bool;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('shareEntries', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -131,8 +131,8 @@ class AndroidAppService {
|
|||
},
|
||||
});
|
||||
if (result != null) return result as bool;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('shareSingle', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -9,40 +9,40 @@ class AndroidDebugService {
|
|||
static Future<void> crash() async {
|
||||
try {
|
||||
await platform.invokeMethod('crash');
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('crash', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> exception() async {
|
||||
try {
|
||||
await platform.invokeMethod('exception');
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('exception', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> safeException() async {
|
||||
try {
|
||||
await platform.invokeMethod('safeException');
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('safeException', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> exceptionInCoroutine() async {
|
||||
try {
|
||||
await platform.invokeMethod('exceptionInCoroutine');
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('exceptionInCoroutine', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<void> safeExceptionInCoroutine() async {
|
||||
try {
|
||||
await platform.invokeMethod('safeExceptionInCoroutine');
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('safeExceptionInCoroutine', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,8 +50,8 @@ class AndroidDebugService {
|
|||
try {
|
||||
final result = await platform.invokeMethod('getContextDirs');
|
||||
if (result != null) return result as Map;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getContextDirs', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ class AndroidDebugService {
|
|||
try {
|
||||
final result = await platform.invokeMethod('getEnv');
|
||||
if (result != null) return result as Map;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getEnv', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -73,8 +73,8 @@ class AndroidDebugService {
|
|||
'uri': entry.uri,
|
||||
});
|
||||
if (result != null) return result as Map;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getBitmapFactoryInfo', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -87,8 +87,8 @@ class AndroidDebugService {
|
|||
'uri': entry.uri,
|
||||
});
|
||||
if (result != null) return result as Map;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getContentResolverMetadata', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -102,8 +102,8 @@ class AndroidDebugService {
|
|||
'sizeBytes': entry.sizeBytes,
|
||||
});
|
||||
if (result != null) return result as Map;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getExifInterfaceMetadata', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -115,8 +115,8 @@ class AndroidDebugService {
|
|||
'uri': entry.uri,
|
||||
});
|
||||
if (result != null) return result as Map;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getMediaMetadataRetrieverMetadata', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -130,8 +130,8 @@ class AndroidDebugService {
|
|||
'sizeBytes': entry.sizeBytes,
|
||||
});
|
||||
if (result != null) return result as Map;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getMetadataExtractorSummary', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -144,8 +144,8 @@ class AndroidDebugService {
|
|||
'uri': entry.uri,
|
||||
});
|
||||
if (result != null) return result as Map;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getTiffStructure', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ class AppShortcutService {
|
|||
_canPin = result;
|
||||
return result;
|
||||
}
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('canPin', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -49,8 +49,8 @@ class AppShortcutService {
|
|||
'iconBytes': iconBytes,
|
||||
'filters': filters.map((filter) => filter.toJson()).toList(),
|
||||
});
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('pin', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ class DeviceService {
|
|||
await platform.invokeMethod('getPerformanceClass');
|
||||
final result = await platform.invokeMethod('getPerformanceClass');
|
||||
if (result != null) return result as int;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getPerformanceClass', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ class PlatformEmbeddedDataService implements EmbeddedDataService {
|
|||
'sizeBytes': entry.sizeBytes,
|
||||
});
|
||||
if (result != null) return (result as List).cast<Uint8List>();
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getExifThumbnail', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ class PlatformEmbeddedDataService implements EmbeddedDataService {
|
|||
'displayName': '${entry.bestTitle} • Video',
|
||||
});
|
||||
if (result != null) return result as Map;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('extractMotionPhotoVideo', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ class PlatformEmbeddedDataService implements EmbeddedDataService {
|
|||
'displayName': '${entry.bestTitle} • Cover',
|
||||
});
|
||||
if (result != null) return result as Map;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('extractVideoEmbeddedPicture', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -74,8 +74,8 @@ class PlatformEmbeddedDataService implements EmbeddedDataService {
|
|||
'propMimeType': propMimeType,
|
||||
});
|
||||
if (result != null) return result as Map;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('extractXmpDataProp', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ class GeocodingService {
|
|||
'maxResults': 2,
|
||||
});
|
||||
return (result as List).cast<Map>().map((map) => Address.fromMap(map)).toList();
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getAddress', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ class GlobalSearch {
|
|||
await platform.invokeMethod('registerCallback', <String, dynamic>{
|
||||
'callbackHandle': PluginUtilities.getCallbackHandle(_init)?.toRawHandle(),
|
||||
});
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('registerCallback', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,8 +124,8 @@ class PlatformImageFileService implements ImageFileService {
|
|||
'mimeType': mimeType,
|
||||
}) as Map;
|
||||
return AvesEntry.fromMap(result);
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getEntry', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -188,8 +188,8 @@ class PlatformImageFileService implements ImageFileService {
|
|||
cancelOnError: true,
|
||||
);
|
||||
return completer.future;
|
||||
} on PlatformException catch (e) {
|
||||
reportService.recordChannelError('getImage', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
reportService.recordError(e, stack);
|
||||
}
|
||||
return Future.sync(() => Uint8List(0));
|
||||
}
|
||||
|
@ -223,8 +223,8 @@ class PlatformImageFileService implements ImageFileService {
|
|||
'imageHeight': imageSize.height.toInt(),
|
||||
});
|
||||
if (result != null) return result as Uint8List;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getRegion', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return Uint8List(0);
|
||||
},
|
||||
|
@ -260,8 +260,8 @@ class PlatformImageFileService implements ImageFileService {
|
|||
'defaultSizeDip': thumbnailDefaultSize,
|
||||
});
|
||||
if (result != null) return result as Uint8List;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getThumbnail', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return Uint8List(0);
|
||||
},
|
||||
|
@ -274,8 +274,8 @@ class PlatformImageFileService implements ImageFileService {
|
|||
Future<void> clearSizedThumbnailDiskCache() async {
|
||||
try {
|
||||
return platform.invokeMethod('clearSizedThumbnailDiskCache');
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('clearSizedThumbnailDiskCache', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,8 +295,8 @@ class PlatformImageFileService implements ImageFileService {
|
|||
'op': 'delete',
|
||||
'entries': entries.map(_toPlatformEntryMap).toList(),
|
||||
}).map((event) => ImageOpEvent.fromMap(event));
|
||||
} on PlatformException catch (e) {
|
||||
reportService.recordChannelError('delete', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
reportService.recordError(e, stack);
|
||||
return Stream.error(e);
|
||||
}
|
||||
}
|
||||
|
@ -314,8 +314,8 @@ class PlatformImageFileService implements ImageFileService {
|
|||
'copy': copy,
|
||||
'destinationPath': destinationAlbum,
|
||||
}).map((event) => MoveOpEvent.fromMap(event));
|
||||
} on PlatformException catch (e) {
|
||||
reportService.recordChannelError('move', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
reportService.recordError(e, stack);
|
||||
return Stream.error(e);
|
||||
}
|
||||
}
|
||||
|
@ -333,8 +333,8 @@ class PlatformImageFileService implements ImageFileService {
|
|||
'mimeType': mimeType,
|
||||
'destinationPath': destinationAlbum,
|
||||
}).map((event) => ExportOpEvent.fromMap(event));
|
||||
} on PlatformException catch (e) {
|
||||
reportService.recordChannelError('export', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
reportService.recordError(e, stack);
|
||||
return Stream.error(e);
|
||||
}
|
||||
}
|
||||
|
@ -356,8 +356,8 @@ class PlatformImageFileService implements ImageFileService {
|
|||
'destinationPath': destinationAlbum,
|
||||
});
|
||||
if (result != null) return (result as Map).cast<String, dynamic>();
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('captureFrame', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -371,8 +371,8 @@ class PlatformImageFileService implements ImageFileService {
|
|||
'newName': newName,
|
||||
});
|
||||
if (result != null) return (result as Map).cast<String, dynamic>();
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('rename', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -386,8 +386,8 @@ class PlatformImageFileService implements ImageFileService {
|
|||
'clockwise': clockwise,
|
||||
});
|
||||
if (result != null) return (result as Map).cast<String, dynamic>();
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('rotate', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -400,8 +400,8 @@ class PlatformImageFileService implements ImageFileService {
|
|||
'entry': _toPlatformEntryMap(entry),
|
||||
});
|
||||
if (result != null) return (result as Map).cast<String, dynamic>();
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('flip', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ class PlatformMediaStoreService implements MediaStoreService {
|
|||
'knownContentIds': knownContentIds,
|
||||
});
|
||||
return (result as List).cast<int>();
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('checkObsoleteContentIds', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
@ -38,8 +38,8 @@ class PlatformMediaStoreService implements MediaStoreService {
|
|||
'knownPathById': knownPathById,
|
||||
});
|
||||
return (result as List).cast<int>();
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('checkObsoletePaths', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
@ -50,8 +50,8 @@ class PlatformMediaStoreService implements MediaStoreService {
|
|||
return _streamChannel.receiveBroadcastStream(<String, dynamic>{
|
||||
'knownEntries': knownEntries,
|
||||
}).map((event) => AvesEntry.fromMap(event));
|
||||
} on PlatformException catch (e) {
|
||||
reportService.recordChannelError('getEntries', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
reportService.recordError(e, stack);
|
||||
return Stream.error(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,8 +35,8 @@ class PlatformMetadataService implements MetadataService {
|
|||
'sizeBytes': entry.sizeBytes,
|
||||
});
|
||||
if (result != null) return result as Map;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getAllMetadata', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -65,8 +65,8 @@ class PlatformMetadataService implements MetadataService {
|
|||
}) as Map;
|
||||
result['contentId'] = entry.contentId;
|
||||
return CatalogMetadata.fromMap(result);
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getCatalogMetadata', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -91,8 +91,8 @@ class PlatformMetadataService implements MetadataService {
|
|||
'sizeBytes': entry.sizeBytes,
|
||||
}) as Map;
|
||||
return OverlayMetadata.fromMap(result);
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getOverlayMetadata', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -113,8 +113,8 @@ class PlatformMetadataService implements MetadataService {
|
|||
imagePage['rotationDegrees'] = entry.rotationDegrees;
|
||||
}
|
||||
return MultiPageInfo.fromPageMaps(entry, pageMaps);
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getMultiPageInfo', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -131,8 +131,8 @@ class PlatformMetadataService implements MetadataService {
|
|||
'sizeBytes': entry.sizeBytes,
|
||||
}) as Map;
|
||||
return PanoramaInfo.fromMap(result);
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('PanoramaInfo', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -145,8 +145,8 @@ class PlatformMetadataService implements MetadataService {
|
|||
'uri': entry.uri,
|
||||
'prop': prop,
|
||||
});
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getContentResolverProp', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -16,10 +16,6 @@ abstract class ReportService {
|
|||
Future<void> recordError(dynamic exception, StackTrace? stack);
|
||||
|
||||
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 {
|
||||
|
|
|
@ -47,8 +47,8 @@ class PlatformStorageService implements StorageService {
|
|||
try {
|
||||
final result = await platform.invokeMethod('getStorageVolumes');
|
||||
return (result as List).cast<Map>().map((map) => StorageVolume.fromMap(map)).toSet();
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getStorageVolumes', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ class PlatformStorageService implements StorageService {
|
|||
'path': volume.path,
|
||||
});
|
||||
return result as int?;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getFreeSpace', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -71,8 +71,8 @@ class PlatformStorageService implements StorageService {
|
|||
try {
|
||||
final result = await platform.invokeMethod('getGrantedDirectories');
|
||||
return (result as List).cast<String>();
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getGrantedDirectories', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
@ -83,8 +83,8 @@ class PlatformStorageService implements StorageService {
|
|||
await platform.invokeMethod('revokeDirectoryAccess', <String, dynamic>{
|
||||
'path': path,
|
||||
});
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('revokeDirectoryAccess', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ class PlatformStorageService implements StorageService {
|
|||
if (result != null) {
|
||||
return (result as List).cast<Map>().map(VolumeRelativeDirectory.fromMap).toSet();
|
||||
}
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getInaccessibleDirectories', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -111,8 +111,8 @@ class PlatformStorageService implements StorageService {
|
|||
if (result != null) {
|
||||
return (result as List).cast<Map>().map(VolumeRelativeDirectory.fromMap).toSet();
|
||||
}
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getRestrictedDirectories', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -134,8 +134,8 @@ class PlatformStorageService implements StorageService {
|
|||
cancelOnError: true,
|
||||
);
|
||||
return completer.future;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('requestVolumeAccess', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -148,8 +148,8 @@ class PlatformStorageService implements StorageService {
|
|||
'dirPaths': dirPaths.toList(),
|
||||
});
|
||||
if (result != null) return result as int;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('deleteEmptyDirectories', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -164,8 +164,8 @@ class PlatformStorageService implements StorageService {
|
|||
'mimeType': mimeType,
|
||||
});
|
||||
if (result != null) return Uri.tryParse(result);
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('scanFile', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -188,8 +188,8 @@ class PlatformStorageService implements StorageService {
|
|||
cancelOnError: true,
|
||||
);
|
||||
return completer.future;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('createFile', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -215,8 +215,8 @@ class PlatformStorageService implements StorageService {
|
|||
cancelOnError: true,
|
||||
);
|
||||
return completer.future;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('openFile', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return Uint8List(0);
|
||||
}
|
||||
|
@ -236,8 +236,8 @@ class PlatformStorageService implements StorageService {
|
|||
cancelOnError: true,
|
||||
);
|
||||
return completer.future;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('selectDirectory', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ class PlatformTimeService implements TimeService {
|
|||
Future<String?> getDefaultTimeZone() async {
|
||||
try {
|
||||
return await platform.invokeMethod('getDefaultTimeZone');
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getDefaultTimeZone', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ class ViewerService {
|
|||
// returns nullable map with 'action' and possibly 'uri' 'mimeType'
|
||||
final result = await platform.invokeMethod('getIntentData');
|
||||
if (result != null) return (result as Map).cast<String, dynamic>();
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('getIntentData', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ class ViewerService {
|
|||
await platform.invokeMethod('pick', <String, dynamic>{
|
||||
'uri': uri,
|
||||
});
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('pick', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ class PlatformWindowService implements WindowService {
|
|||
await platform.invokeMethod('keepScreenOn', <String, dynamic>{
|
||||
'on': on,
|
||||
});
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('keepScreenOn', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,8 @@ class PlatformWindowService implements WindowService {
|
|||
try {
|
||||
final result = await platform.invokeMethod('isRotationLocked');
|
||||
if (result != null) return result as bool;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('isRotationLocked', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -61,8 +61,8 @@ class PlatformWindowService implements WindowService {
|
|||
await platform.invokeMethod('requestOrientation', <String, dynamic>{
|
||||
'orientation': orientationCode,
|
||||
});
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('requestOrientation', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,8 +71,8 @@ class PlatformWindowService implements WindowService {
|
|||
try {
|
||||
final result = await platform.invokeMethod('canSetCutoutMode');
|
||||
if (result != null) return result as bool;
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('canSetCutoutMode', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -83,8 +83,8 @@ class PlatformWindowService implements WindowService {
|
|||
await platform.invokeMethod('setCutoutMode', <String, dynamic>{
|
||||
'use': use,
|
||||
});
|
||||
} on PlatformException catch (e) {
|
||||
await reportService.recordChannelError('setCutoutMode', e);
|
||||
} on PlatformException catch (e, stack) {
|
||||
await reportService.recordError(e, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue