Baseflow / flutter_cached_network_image

Download, cache and show images in a flutter app
https://baseflow.com
2.44k stars 656 forks source link

errorListener not catching all errors #912

Open krll-kov opened 10 months ago

krll-kov commented 10 months ago
PathAccessException: Cannot delete file, path = 'C:\Users\7636~1\AppData\Local\Temp\libCachedImageData\a1ae03b0-5abe-1dd1-8533-276b5a6910cc.png' (OS Error: Отказано в доступе., errno = 5); 
#0      _checkForErrorResponse (dart:io/common.dart:55)
#1      _File._delete.<anonymous closure> (dart:io/file_impl.dart:315)<asynchronous suspension>
#2      ForwardingFileSystemEntity.delete (package:file/src/forwarding/forwarding_file_system_entity.dart:66)<asynchronous suspension>
#3      CacheStore._removeCachedFile (package:flutter_cache_manager/src/cache_store.dart:187)<asynchronous suspension>
PathNotFoundException: Cannot delete file, path = 'C:\Users\7636~1\AppData\Local\Temp\libCachedImageData\2ed44830-61ef-1dd1-8533-276b5a6910cc.png' (OS Error: Не удается найти указанный файл., errno = 2); 
#0      _checkForErrorResponse (dart:io/common.dart:55)
#1      _File._delete.<anonymous closure> (dart:io/file_impl.dart:315)<asynchronous suspension>
#2      ForwardingFileSystemEntity.delete (package:file/src/forwarding/forwarding_file_system_entity.dart:66)<asynchronous suspension>
#3      CacheStore._removeCachedFile (package:flutter_cache_manager/src/cache_store.dart:187)<asynchronous suspension>
Exception: Invalid image data; #0      _futurize (dart:ui/painting.dart:6950)
#1      ImageDescriptor.encoded (dart:ui/painting.dart:6764)
#2      instantiateImageCodecWithSize (dart:ui/painting.dart:2307)
#3      FileImage._loadAsync (package:flutter/src/painting/image_provider.dart:1598)<asynchronous suspension>
FormatException: Unexpected character (at character 1)                                                                           ...^; 
#0      _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383)
#1      _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1250)
#2      _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:915)
#3      _parseJson (dart:convert-patch/convert_patch.dart:35)
#4      JsonDecoder.convert (dart:convert/json.dart:610)
#5      JsonCodec.decode (dart:convert/json.dart:216)
#6      jsonDecode (dart:convert/json.dart:155)
#7      JsonCacheInfoRepository._readFile (package:flutter_cache_manager/src/storage/cache_info_repositories/json_cache_info_repository.dart:143)<asynchronous suspension>
#8      JsonCacheInfoRepository.open (package:flutter_cache_manager/src/storage/cache_info_repositories/json_cache_info_repository.dart:40)<asynchronous suspension>
#9      CacheStore._getCacheDataFromDatabase (package:flutter_cache_manager/src/cache_store.dart:112)<asynchronous suspension>
FileSystemException: writeFrom failed, path = 'C:\Users\1\AppData\Roaming\com.swiftsoft\ExLoader\libCachedImageData.json' (OS Error: Недостаточно места на диске., errno = 112); 
#0      _checkForErrorResponse (dart:io/common.dart:55)
#1      _RandomAccessFile.writeFrom.<anonymous closure> (dart:io/file_impl.dart:884)<asynchronous suspension>
#2      JsonCacheInfoRepository._saveFile (package:flutter_cache_manager/src/storage/cache_info_repositories/json_cache_info_repository.dart:191)<asynchronous suspension>
FormatException: Unexpected character (at character 10837)...40823130,"length":1451183,"_id":36}]{"url":"https://data.exloader.net/im...

Hi, i've added an errors listener as mentioned in the update-log: image but it does not catch all errors and still throw a lot of stuff to PlatformDispatcher.instance.onError/FlutterError.onError callbacks.

muhib349 commented 10 months ago

Can you please tell me how I can reproduce this issue?

krll-kov commented 10 months ago

Have no idea, these are automatically send to server from users when they have this errors, personally, I've never faced this problems myself, but there are too many of this logs on the server

mmga commented 2 months ago

Hi @kirill-21 kirill, any updates on this? I've found a PR that might be related, would it help? https://github.com/Baseflow/flutter_cached_network_image/pull/937

Have no idea, these are automatically send to server from users when they have this errors, personally, I've never faced this problems myself, but there are too many of this logs on the server

krll-kov commented 2 months ago

Hi @kirill-21 kirill, any updates on this? I've found a PR that might be related, would it help? #937

Have no idea, these are automatically send to server from users when they have this errors, personally, I've never faced this problems myself, but there are too many of this logs on the server

I ended up deleting this package from my project and writing my own network cache system