error log change
This commit is contained in:
parent
e57d6fecff
commit
656821225b
5 changed files with 29 additions and 44 deletions
|
@ -267,7 +267,7 @@ class MetadataHandler(private val context: Context) : MethodCallHandler {
|
||||||
if (metadataMap.isNotEmpty()) {
|
if (metadataMap.isNotEmpty()) {
|
||||||
result.success(metadataMap)
|
result.success(metadataMap)
|
||||||
} else {
|
} else {
|
||||||
result.error("getAllMetadata-failure", "failed to get metadata for uri=$uri", null)
|
result.error("getAllMetadata-failure", "failed to get metadata for mimeType=$mimeType uri=$uri", null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,9 +474,9 @@ class MetadataHandler(private val context: Context) : MethodCallHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.w(LOG_TAG, "failed to get catalog metadata by metadata-extractor for uri=$uri, mimeType=$mimeType", e)
|
Log.w(LOG_TAG, "failed to get catalog metadata by metadata-extractor for mimeType=$mimeType uri=$uri", e)
|
||||||
} catch (e: NoClassDefFoundError) {
|
} catch (e: NoClassDefFoundError) {
|
||||||
Log.w(LOG_TAG, "failed to get catalog metadata by metadata-extractor for uri=$uri, mimeType=$mimeType", e)
|
Log.w(LOG_TAG, "failed to get catalog metadata by metadata-extractor for mimeType=$mimeType uri=$uri", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,7 +502,7 @@ class MetadataHandler(private val context: Context) : MethodCallHandler {
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
// ExifInterface initialization can fail with a RuntimeException
|
// ExifInterface initialization can fail with a RuntimeException
|
||||||
// caused by an internal MediaMetadataRetriever failure
|
// caused by an internal MediaMetadataRetriever failure
|
||||||
Log.w(LOG_TAG, "failed to get metadata by ExifInterface for uri=$uri", e)
|
Log.w(LOG_TAG, "failed to get metadata by ExifInterface for mimeType=$mimeType uri=$uri", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,9 +597,9 @@ class MetadataHandler(private val context: Context) : MethodCallHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.w(LOG_TAG, "failed to get metadata by metadata-extractor for uri=$uri", e)
|
Log.w(LOG_TAG, "failed to get metadata by metadata-extractor for mimeType=$mimeType uri=$uri", e)
|
||||||
} catch (e: NoClassDefFoundError) {
|
} catch (e: NoClassDefFoundError) {
|
||||||
Log.w(LOG_TAG, "failed to get metadata by metadata-extractor for uri=$uri", e)
|
Log.w(LOG_TAG, "failed to get metadata by metadata-extractor for mimeType=$mimeType uri=$uri", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -616,7 +616,7 @@ class MetadataHandler(private val context: Context) : MethodCallHandler {
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
// ExifInterface initialization can fail with a RuntimeException
|
// ExifInterface initialization can fail with a RuntimeException
|
||||||
// caused by an internal MediaMetadataRetriever failure
|
// caused by an internal MediaMetadataRetriever failure
|
||||||
Log.w(LOG_TAG, "failed to get metadata by ExifInterface for uri=$uri", e)
|
Log.w(LOG_TAG, "failed to get metadata by ExifInterface for mimeType=$mimeType uri=$uri", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,7 +639,7 @@ class MetadataHandler(private val context: Context) : MethodCallHandler {
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
if (pages?.isEmpty() == true) {
|
if (pages?.isEmpty() == true) {
|
||||||
result.error("getMultiPageInfo-empty", "failed to get pages for uri=$uri", null)
|
result.error("getMultiPageInfo-empty", "failed to get pages for mimeType=$mimeType uri=$uri", null)
|
||||||
} else {
|
} else {
|
||||||
result.success(pages)
|
result.success(pages)
|
||||||
}
|
}
|
||||||
|
@ -680,7 +680,7 @@ class MetadataHandler(private val context: Context) : MethodCallHandler {
|
||||||
Log.w(LOG_TAG, "failed to read XMP", e)
|
Log.w(LOG_TAG, "failed to read XMP", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.error("getPanoramaInfo-empty", "failed to read XMP from uri=$uri", null)
|
result.error("getPanoramaInfo-empty", "failed to read XMP for mimeType=$mimeType uri=$uri", null)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hasContentResolverProp(call: MethodCall, result: MethodChannel.Result) {
|
private fun hasContentResolverProp(call: MethodCall, result: MethodChannel.Result) {
|
||||||
|
|
|
@ -446,14 +446,6 @@
|
||||||
"@dateYesterday": {},
|
"@dateYesterday": {},
|
||||||
"dateThisMonth": "This month",
|
"dateThisMonth": "This month",
|
||||||
"@dateThisMonth": {},
|
"@dateThisMonth": {},
|
||||||
"errorUnsupportedMimeType": "{mimeType} not supported",
|
|
||||||
"@errorUnsupportedMimeType": {
|
|
||||||
"placeholders": {
|
|
||||||
"mimeType": {
|
|
||||||
"type": "String"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"collectionDeleteFailureFeedback": "{count, plural, =1{Failed to delete 1 item} other{Failed to delete {count} items}}",
|
"collectionDeleteFailureFeedback": "{count, plural, =1{Failed to delete 1 item} other{Failed to delete {count} items}}",
|
||||||
"@collectionDeleteFailureFeedback": {
|
"@collectionDeleteFailureFeedback": {
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
|
|
|
@ -212,7 +212,6 @@
|
||||||
"dateToday": "오늘",
|
"dateToday": "오늘",
|
||||||
"dateYesterday": "어제",
|
"dateYesterday": "어제",
|
||||||
"dateThisMonth": "이번 달",
|
"dateThisMonth": "이번 달",
|
||||||
"errorUnsupportedMimeType": "{mimeType} 지원되지 않음",
|
|
||||||
"collectionDeleteFailureFeedback": "{count, plural, other{항목 {count}개를 삭제하지 못했습니다}}",
|
"collectionDeleteFailureFeedback": "{count, plural, other{항목 {count}개를 삭제하지 못했습니다}}",
|
||||||
"collectionCopyFailureFeedback": "{count, plural, other{항목 {count}개를 복사하지 못했습니다}}",
|
"collectionCopyFailureFeedback": "{count, plural, other{항목 {count}개를 복사하지 못했습니다}}",
|
||||||
"collectionMoveFailureFeedback": "{count, plural, other{항목 {count}개를 이동하지 못했습니다}}",
|
"collectionMoveFailureFeedback": "{count, plural, other{항목 {count}개를 이동하지 못했습니다}}",
|
||||||
|
|
|
@ -11,13 +11,11 @@ import 'package:flutter/material.dart';
|
||||||
class ErrorThumbnail extends StatefulWidget {
|
class ErrorThumbnail extends StatefulWidget {
|
||||||
final AvesEntry entry;
|
final AvesEntry entry;
|
||||||
final double extent;
|
final double extent;
|
||||||
final String tooltip;
|
|
||||||
|
|
||||||
const ErrorThumbnail({
|
const ErrorThumbnail({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.entry,
|
required this.entry,
|
||||||
required this.extent,
|
required this.extent,
|
||||||
required this.tooltip,
|
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -48,27 +46,27 @@ class _ErrorThumbnailState extends State<ErrorThumbnail> {
|
||||||
child = const SizedBox();
|
child = const SizedBox();
|
||||||
} else {
|
} else {
|
||||||
final exists = snapshot.data!;
|
final exists = snapshot.data!;
|
||||||
child = Tooltip(
|
child = exists
|
||||||
message: exists ? widget.tooltip : context.l10n.viewerErrorDoesNotExist,
|
? LayoutBuilder(builder: (context, constraints) {
|
||||||
preferBelow: false,
|
final fontSize = min(extent, constraints.biggest.width) / 5;
|
||||||
child: exists
|
return Text(
|
||||||
? LayoutBuilder(builder: (context, constraints) {
|
MimeUtils.displayType(entry.mimeType),
|
||||||
final fontSize = min(extent, constraints.biggest.width) / 5;
|
style: TextStyle(
|
||||||
return Text(
|
color: color,
|
||||||
MimeUtils.displayType(entry.mimeType),
|
fontSize: fontSize,
|
||||||
style: TextStyle(
|
),
|
||||||
color: color,
|
textAlign: TextAlign.center,
|
||||||
fontSize: fontSize,
|
);
|
||||||
),
|
})
|
||||||
textAlign: TextAlign.center,
|
: Tooltip(
|
||||||
);
|
message: context.l10n.viewerErrorDoesNotExist,
|
||||||
})
|
preferBelow: false,
|
||||||
: Icon(
|
child: Icon(
|
||||||
AIcons.broken,
|
AIcons.broken,
|
||||||
size: extent / 2,
|
size: extent / 2,
|
||||||
color: color,
|
color: color,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Container(
|
return Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
|
|
|
@ -8,7 +8,6 @@ import 'package:aves/model/settings/entry_background.dart';
|
||||||
import 'package:aves/model/settings/enums.dart';
|
import 'package:aves/model/settings/enums.dart';
|
||||||
import 'package:aves/model/settings/settings.dart';
|
import 'package:aves/model/settings/settings.dart';
|
||||||
import 'package:aves/services/services.dart';
|
import 'package:aves/services/services.dart';
|
||||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
|
||||||
import 'package:aves/widgets/common/fx/checkered_decoration.dart';
|
import 'package:aves/widgets/common/fx/checkered_decoration.dart';
|
||||||
import 'package:aves/widgets/common/fx/transition_image.dart';
|
import 'package:aves/widgets/common/fx/transition_image.dart';
|
||||||
import 'package:aves/widgets/common/providers/media_query_data_provider.dart';
|
import 'package:aves/widgets/common/providers/media_query_data_provider.dart';
|
||||||
|
@ -173,10 +172,8 @@ class _ThumbnailImageState extends State<ThumbnailImage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (!entry.canDecode) {
|
if (!entry.canDecode || _lastException != null) {
|
||||||
return _buildError(context, context.l10n.errorUnsupportedMimeType(entry.mimeType), null);
|
return _buildError(context);
|
||||||
} else if (_lastException != null) {
|
|
||||||
return _buildError(context, _lastException.toString(), null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// use `RawImage` instead of `Image`, using `ImageInfo` to check dimensions
|
// use `RawImage` instead of `Image`, using `ImageInfo` to check dimensions
|
||||||
|
@ -246,11 +243,10 @@ class _ThumbnailImageState extends State<ThumbnailImage> {
|
||||||
: image;
|
: image;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildError(BuildContext context, Object error, StackTrace? stackTrace) {
|
Widget _buildError(BuildContext context) {
|
||||||
final child = ErrorThumbnail(
|
final child = ErrorThumbnail(
|
||||||
entry: entry,
|
entry: entry,
|
||||||
extent: extent,
|
extent: extent,
|
||||||
tooltip: error.toString(),
|
|
||||||
);
|
);
|
||||||
return widget.heroTag != null
|
return widget.heroTag != null
|
||||||
? Hero(
|
? Hero(
|
||||||
|
|
Loading…
Reference in a new issue