mirror of
https://github.com/immich-app/immich.git
synced 2025-07-08 02:34:12 -04:00
error handling for async calls
This commit is contained in:
parent
6c8f7b7e6d
commit
71e058af2e
@ -65,7 +65,7 @@ class NativeVideoViewerPage extends HookConsumerWidget {
|
|||||||
final log = Logger('NativeVideoViewerPage');
|
final log = Logger('NativeVideoViewerPage');
|
||||||
|
|
||||||
final localEntity = useMemoized(() {
|
final localEntity = useMemoized(() {
|
||||||
if (!asset.isLocal) {
|
if (!asset.isLocal || asset.isMotionPhoto) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ class NativeVideoViewerPage extends HookConsumerWidget {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localEntity != null && asset.livePhotoVideoId == null) {
|
if (localEntity != null) {
|
||||||
final file = await (await localEntity)!.file;
|
final file = await (await localEntity)!.file;
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
throw Exception('No file found for the video');
|
throw Exception('No file found for the video');
|
||||||
@ -151,8 +151,18 @@ class NativeVideoViewerPage extends HookConsumerWidget {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final (videoSourceRes, aspectRatioRes) =
|
late final VideoSource? videoSourceRes;
|
||||||
|
late final double? aspectRatioRes;
|
||||||
|
try {
|
||||||
|
(videoSourceRes, aspectRatioRes) =
|
||||||
await (createSource(), calculateAspectRatio()).wait;
|
await (createSource(), calculateAspectRatio()).wait;
|
||||||
|
} catch (error) {
|
||||||
|
log.severe(
|
||||||
|
'Error initializing video for asset ${asset.fileName}: $error',
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (videoSourceRes == null || aspectRatioRes == null) {
|
if (videoSourceRes == null || aspectRatioRes == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user