问题描述
在调用onFailure回调并将异常错误消息设置为null时,是否有任何方法可以找出导致Google Drive API失败的原因?对于API的开发人员来说,抛出异常而没有任何特定的子类并且没有关于失败原因的任何信息,甚至是合法的方法吗?
在我看来,这只是由Google不良的编码风格和软件开发文化恶化引起的bug,但是让我知道,可能我错过了Google使用的当代敏捷方法的最新趋势。 / p>
目前尚不清楚在这种情况下向用户显示什么内容,除了晦涩和令人困惑,但不幸的是非常常见的“ UnkNown GDrive Error”消息。
Tasks.call(mExecutor,Callable<Int>{
var pagetoken: String? = null
var textFound = false
var otherFound = false
var cnt = 0
do {
val q = mDrive!!.files().list()
.setQ("name='some-text' or name='other-text'")
.setSpaces("drive")
.setFields("nextPagetoken,files(id,name)")
.setPagetoken(pagetoken)
.setorderBy("modifiedTime desc")
val files = q.execute()
for (file in files.getFiles()) {
textFound = file.name.equals("some-text")
otherFound = file.name.equals("other-text")
}
pagetoken = files.nextPagetoken
} while (pagetoken != null)
cnt += if (plainFound) 1 else 0
cnt += if (encFound) 1 else 0
return@Callable cnt
}).addOnFailureListener { it: Exception
// it.message is equal to NULL here and I don't kNow what to tell the user
// except that obscure "UnkNown GDrive Error"
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)