Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unity Firebase存储错误未返回错误_Firebase_Unity3d_Error Handling_Firebase Storage - Fatal编程技术网

Unity Firebase存储错误未返回错误

Unity Firebase存储错误未返回错误,firebase,unity3d,error-handling,firebase-storage,Firebase,Unity3d,Error Handling,Firebase Storage,使用Unity从Firebase存储加载文件时: 如果文件不存在,“ErrorRetryLimitExceeded”是唯一返回的错误,它需要几分钟的时间。为什么没有返回“ErrorObjectNotFound”或其他错误 以下是统一代码: public void Load (string folderName, Action<byte[]> loadResults = null) { StorageFileName (folderName); ServicePoin

使用Unity从Firebase存储加载文件时:

如果文件不存在,“ErrorRetryLimitExceeded”是唯一返回的错误,它需要几分钟的时间。为什么没有返回“ErrorObjectNotFound”或其他错误

以下是统一代码:

public void Load (string folderName, Action<byte[]> loadResults = null)
{

    StorageFileName (folderName);
    ServicePointToggle (true);
    const long maxAllowedSize = 4 * 1024 * 1024;

    imaginary_ref.GetBytesAsync (maxAllowedSize).ContinueWith (task => {
        if (task.IsFaulted || task.IsCanceled) {
            Debug.Log (FirebaseStorageException (task.Exception));

        } else {
            Debug.Log("success");
        }
    });
}

public string FirebaseStorageException (Exception taskException)
{

    AggregateException ex = taskException as AggregateException;
    if (ex != null) {
        StorageException inner = ex.InnerExceptions [0] as StorageException;

        if (inner != null) {
            switch (inner.ErrorCode) {
            case StorageException.ErrorBucketNotFound:
                errorText = "Bucket Not Found";
                break; 
            case StorageException.ErrorCanceled:
                errorText = "Canceled";
                break; 
            case StorageException.ErrorInvalidChecksum:
                errorText = "Invalid Checksum";
                break; 
            case StorageException.ErrorNotAuthenticated:
                errorText = "Not Authenticated";
                break; 
            case StorageException.ErrorNotAuthorized:
                errorText = "Not Authorized";
                break; 
            case StorageException.ErrorObjectNotFound:
                errorText = "Object Not Found";
                break; 
            case StorageException.ErrorProjectNotFound:
                errorText = "Project Not Found";
                break; 
            case StorageException.ErrorQuotaExceeded:
                errorText = "Quota Exceeded";
                break; 
            case StorageException.ErrorRetryLimitExceeded:
                errorText = "Retry Exceeded";
                break; 
            case StorageException.ErrorUnknown:
                errorText = "Error Unknown";
                break; 
            }

        }

    }
    return errorText;
}
public void Load(字符串folderName,Action loadResults=null)
{
StorageFileName(folderName);
ServicePointToggle(真);
const long maxAllowedSize=4*1024*1024;
虚拟的\u ref.getByteAsync(maxAllowedSize)。继续(任务=>{
if(task.IsFaulted | | task.IsCanceled){
Log(FirebaseStorageException(task.Exception));
}否则{
Debug.Log(“成功”);
}
});
}
公共字符串FirebaseStorageException(异常任务异常)
{
AggregateException ex=任务异常作为AggregateException;
如果(ex!=null){
StorageException inner=ex.InnerExceptions[0]作为StorageException;
if(内部!=null){
开关(内部错误代码){
案例StorageException.ErrorBucketNotFound:
errorText=“未找到存储桶”;
打破
案例StorageException.ErrorCancelled:
errorText=“已取消”;
打破
case StorageException.ErrorInvalidChecksum:
errorText=“无效校验和”;
打破
案例StorageException.ErrorNotAuthentication:
errorText=“未验证”;
打破
案例StorageException.ErrorNotAuthorized:
errorText=“未授权”;
打破
case StorageException.ErrorObjectNotFound:
errorText=“未找到对象”;
打破
案例StorageException.ErrorProjectNotFound:
errorText=“未找到项目”;
打破
case StorageException.ErrorQuotaExceed:
errorText=“超出配额”;
打破
case StorageException.ErrorRetryLimitExceed:
errorText=“超出重试次数”;
打破
案例StorageException.ErrorUnknown:
errorText=“错误未知”;
打破
}
}
}
返回错误文本;
}

嗯。。。你确定路径存在吗?我猜你已经有了一个FireBaseStorage ref。我肯定。。。如果文件存在,则可以加载。。。但如果不是,它将花费很长时间,只返回超出重试限制的结果。我希望实现的是,如果文件不存在,它将返回一个找不到的错误。。