"message":"gameThirdScriptError
renameSync:fail ERR_EXCEED_DIRECTORY_MAX_SIZE;at api downloadFile success callback function
Error: renameSync:fail ERR_EXCEED_DIRECTORY_MAX_SIZE
at Object.i [as renameSync] (<anonymous>:206:8012)
请问这个rename时候的报错是说文件夹内部大小超过上限还是文件数量?按道理rename不应该影响大小或者文件数量啊,只是重命名而已,如果有上限的话,那上限又是多少呢?
文档里并没有说renameSync会报这个错误呀
(玩家的wx.onError里抓到的,所以微信版本和基础库版本不确定)
麻烦给个相关的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html),我们定位下问题
这个问题不是必现的,我们是通过
wx.onError(
function
(err) {
let errorMsg = JSON.stringify(err);
//上传errorMsg
}
这样的方式获取到的用户报错信息
{
"message"
:
"gameThirdScriptError
renameSync:fail ERR_EXCEED_DIRECTORY_MAX_SIZE;at api downloadFile success callback function
Error: renameSync:fail ERR_EXCEED_DIRECTORY_MAX_SIZE
at Object.i [as renameSync] (<anonymous>:206:8012)
at Object.<anonymous> (<anonymous>:202:3592)
at s.<anonymous> (<anonymous>:205:11303)
at s.emit (<anonymous>:203:17125)
at Function.<anonymous> (<anonymous>:205:12337)
at <anonymous>:202:13691
at Object.S (<anonymous>:199:1677)
at Object.ret.subscribeHandler (<anonymous>:25:28)
at <anonymous>:1:67"
,
"stack"
:
""
}
renameSync函数封装成这样:
renameSync: (oldPath, newPath) => {
wxFs.renameSync(WX_ROOT + oldPath, WX_ROOT + newPath)
}
调用方式是:
wx.downloadFile({
url: url,
filePath: targetFullPath +
'.tmp'
,
success: (res)=> {
if
(!res.statusCode || res.statusCode >= 400) {
console.error(
'download with statusCode and url:'
, res.statusCode, url);
reject(
new
RES.ResourceManagerError(1001,
'download with statusCode:'
+ res.statusCode));
}
else
{
console.log(
'Finish Download, rename from '
, target +
'.tmp to'
, target);
fileutil.fs.renameSync(target +
'.tmp'
, target);
resolve();
}
},
fail: (e) => {
console.error(e)
reject(
new
RES.ResourceManagerError(1001, e))
}
})
请问这个问题解决了吗?我现在也是报renameSync:fail ERR_EXCEED_DIRECTORY_MAX_SIZE
另外,顺便问一下,在promise里的unhandled rejection报错,wx.onError并不能捕获,还有什么方式可以抓取到吗?用标准里的
window.addEventListener("unhandledrejection", function (event) {
//...
});
也不能监听到