error log change

This commit is contained in:
Thibault Deckers 2021-09-02 16:12:37 +09:00
parent e57d6fecff
commit 656821225b
5 changed files with 29 additions and 44 deletions

View file

@ -267,7 +267,7 @@ class MetadataHandler(private val context: Context) : MethodCallHandler {
if (metadataMap.isNotEmpty()) {
result.success(metadataMap)
} 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) {
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) {
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) {
// ExifInterface initialization can fail with a RuntimeException
// 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) {
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) {
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) {
// ExifInterface initialization can fail with a RuntimeException
// 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
}
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 {
result.success(pages)
}
@ -680,7 +680,7 @@ class MetadataHandler(private val context: Context) : MethodCallHandler {
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) {

View file

@ -446,14 +446,6 @@
"@dateYesterday": {},
"dateThisMonth": "This month",
"@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": {
"placeholders": {

View file

@ -212,7 +212,6 @@
"dateToday": "오늘",
"dateYesterday": "어제",
"dateThisMonth": "이번 달",
"errorUnsupportedMimeType": "{mimeType} 지원되지 않음",
"collectionDeleteFailureFeedback": "{count, plural, other{항목 {count}개를 삭제하지 못했습니다}}",
"collectionCopyFailureFeedback": "{count, plural, other{항목 {count}개를 복사하지 못했습니다}}",
"collectionMoveFailureFeedback": "{count, plural, other{항목 {count}개를 이동하지 못했습니다}}",

View file

@ -11,13 +11,11 @@ import 'package:flutter/material.dart';
class ErrorThumbnail extends StatefulWidget {
final AvesEntry entry;
final double extent;
final String tooltip;
const ErrorThumbnail({
Key? key,
required this.entry,
required this.extent,
required this.tooltip,
}) : super(key: key);
@override
@ -48,27 +46,27 @@ class _ErrorThumbnailState extends State<ErrorThumbnail> {
child = const SizedBox();
} else {
final exists = snapshot.data!;
child = Tooltip(
message: exists ? widget.tooltip : context.l10n.viewerErrorDoesNotExist,
preferBelow: false,
child: exists
? LayoutBuilder(builder: (context, constraints) {
final fontSize = min(extent, constraints.biggest.width) / 5;
return Text(
MimeUtils.displayType(entry.mimeType),
style: TextStyle(
color: color,
fontSize: fontSize,
),
textAlign: TextAlign.center,
);
})
: Icon(
child = exists
? LayoutBuilder(builder: (context, constraints) {
final fontSize = min(extent, constraints.biggest.width) / 5;
return Text(
MimeUtils.displayType(entry.mimeType),
style: TextStyle(
color: color,
fontSize: fontSize,
),
textAlign: TextAlign.center,
);
})
: Tooltip(
message: context.l10n.viewerErrorDoesNotExist,
preferBelow: false,
child: Icon(
AIcons.broken,
size: extent / 2,
color: color,
),
);
);
}
return Container(
alignment: Alignment.center,

View file

@ -8,7 +8,6 @@ import 'package:aves/model/settings/entry_background.dart';
import 'package:aves/model/settings/enums.dart';
import 'package:aves/model/settings/settings.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/transition_image.dart';
import 'package:aves/widgets/common/providers/media_query_data_provider.dart';
@ -173,10 +172,8 @@ class _ThumbnailImageState extends State<ThumbnailImage> {
@override
Widget build(BuildContext context) {
if (!entry.canDecode) {
return _buildError(context, context.l10n.errorUnsupportedMimeType(entry.mimeType), null);
} else if (_lastException != null) {
return _buildError(context, _lastException.toString(), null);
if (!entry.canDecode || _lastException != null) {
return _buildError(context);
}
// use `RawImage` instead of `Image`, using `ImageInfo` to check dimensions
@ -246,11 +243,10 @@ class _ThumbnailImageState extends State<ThumbnailImage> {
: image;
}
Widget _buildError(BuildContext context, Object error, StackTrace? stackTrace) {
Widget _buildError(BuildContext context) {
final child = ErrorThumbnail(
entry: entry,
extent: extent,
tooltip: error.toString(),
);
return widget.heroTag != null
? Hero(