gpt4 book ai didi

java - firebase StorageException 被打印,即使我处理它

转载 作者:行者123 更新时间:2023-12-01 16:36:44 26 4
gpt4 key购买 nike

我想检查 Firebase 存储中是否存在文件,如果存在则更新其元数据。OnFailureListener 按预期工作,如下所示:

storageRef.child("users/me/file.png").getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
// Got the download URL for 'users/me/profile.png'
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// File not found
}
});

但是,我在 logcat 上收到此错误跟踪:

2020-05-21 01:45:04.484 10910-11160/pl.edu.mimuw.exshare E/StorageException: StorageException has occurred.
Object does not exist at location.
Code: -13010 HttpResult: 404
2020-05-21 01:45:04.489 10910-11160/pl.edu.mimuw.exshare E/StorageException: { "error": { "code": 404, "message": "Not Found. Could not get object", "status": "GET_OBJECT" }}
java.io.IOException: { "error": { "code": 404, "message": "Not Found. Could not get object", "status": "GET_OBJECT" }}
at com.google.firebase.storage.network.NetworkRequest.parseResponse(com.google.firebase:firebase-storage@@19.1.1:433)
at com.google.firebase.storage.network.NetworkRequest.parseErrorResponse(com.google.firebase:firebase-storage@@19.1.1:450)
at com.google.firebase.storage.network.NetworkRequest.processResponseStream(com.google.firebase:firebase-storage@@19.1.1:441)
at com.google.firebase.storage.network.NetworkRequest.performRequest(com.google.firebase:firebase-storage@@19.1.1:272)
at com.google.firebase.storage.network.NetworkRequest.performRequest(com.google.firebase:firebase-storage@@19.1.1:286)
at com.google.firebase.storage.internal.ExponentialBackoffSender.sendWithExponentialBackoff(com.google.firebase:firebase-storage@@19.1.1:70)
at com.google.firebase.storage.internal.ExponentialBackoffSender.sendWithExponentialBackoff(com.google.firebase:firebase-storage@@19.1.1:62)
at com.google.firebase.storage.GetMetadataTask.run(com.google.firebase:firebase-storage@@19.1.1:61)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)

有什么方法可以阻止打印此错误消息吗?

最佳答案

如果存储 SDK 在日志中打印某些内容,则除了从 open source 自行构建 SDK 之外,您无法更改该行为。 ,并删除您不需要的日志记录。

或者,您可以忽略该日志。或者您可以在 GitHub 上提交问题并要求开发人员将其删除。

关于java - firebase StorageException 被打印,即使我处理它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61934181/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com