hmjz100/LinkSwift · error · Error
[中国移动云盘] 获取文件 URL 失败
Error message
[中国移动云盘] 获取文件 URL 失败
What it means
Fallback error in the China Mobile Cloud Drive getLink(): after Promise.all over the batch queue rejects, non-Error rejection values are converted into this message. It means one of the per-file URL fetch tasks failed without throwing a proper Error (e.g. it rejected with a string or object), and even its message field was empty/absent.
Source
Thrown at (改)网盘直链下载助手.user.js:7065
const batchSize = 15;
let proc = 0;
$doc.find(".loading-popup .loading-title").html(`链接获取中`);
$doc.find(".loading-popup .swal2-html-container").html(`<div>正在获取文件对应的下载链接~</div>`);
for (let i = 0; i < selects.length; i += batchSize) {
const batch = selects.slice(i, i + batchSize);
const queue = [];
batch.forEach((item, localIndex) => {
const globalIndex = i + localIndex;
queue.push(this.getFileUrl(item, globalIndex)
.then(val => {
proc++;
$doc.find(".loading-popup .swal2-html-container").html(`<div>已获取 ${proc} / ${selects.length} 个链接~</div>`);
return val;
}));
});
const res = await Promise.all(queue).catch(e => {
if (e instanceof Error) throw e;
throw new Error(e?.message || e || "[中国移动云盘] 获取文件 URL 失败");
});
res.forEach(val => (selects[val.index].downloadUrl = val.downloadUrl));
await base.sleep(1000);
}
} else {
throw new Error("提示:<br/>页面错误~");
}
temp.links = [selects, {
isFolder: v => (v.dirEtag || v.caName),
getFileName: v => (v.contentName || v.coName),
getFileSize: v => (v.contentSize || v.coSize),
getFileLink: v => v.downloadUrl,
tooltip: config.$mcloud.dom
}];
base.showMainDialog(config.base.dom.button[temp.mode].title, base.generateDOM(temp.links), config.base.dom.button[temp.mode].footer);
},
getSelectedList() {
try {
View on GitHub (pinned to 417ea5e28a)
Solutions
- Refresh the page and retry; failures are often transient network/API issues.
- Inspect the per-file fetch logic: log the original rejection value before it reaches this catch to see the real cause.
- Reduce batch size (currently 15) or add retry/delay to avoid rate limiting from 中国移动云盘.
- Ensure each task throws new Error(...) with a message so errors surface with real causes instead of this fallback.
Example fix
// before
tasks.push(fetchFileUrl(item).catch(e => { throw e?.message || e; }));
// after
tasks.push(fetchFileUrl(item).catch(e => {
throw new Error('[中国移动云盘] 获取文件 URL 失败: ' + (e?.message ?? String(e)));
})); Defensive patterns
Strategy: try-catch
Type guard
function isRealError(e) {
return e instanceof Error;
} Try / catch
try {
await Promise.all(queue);
} catch (e) {
console.error('原始失败原因:', e);
if (e instanceof Error) throw e;
throw new Error('[中国移动云盘] 获取文件 URL 失败: ' + String(e));
} Prevention
- Make per-file tasks always throw new Error(...) with a descriptive message.
- Log rejection values in the per-task catch before rethrowing.
- Lower batch size / add delays to avoid API rate limiting.
- Retry transient failures once before failing the whole batch.
When it happens
Trigger: Any batch task inside the queue rejects with a non-Error value whose ?message is falsy — e.g. a promise rejection with undefined, an empty string, or an object without a message property, caught at line 7065.
Common situations: The cloud API returned a malformed/empty error body that the per-file handler rejected with raw; a network failure produced a rejection without message; concurrency limit or rate limiting caused silent task failure.
Related errors
- [百度网盘] 获取文件 URL 失败
- [阿里云盘] 获取文件 URL 失败
- [天翼云盘] 获取文件 URL 失败
- [光鸭云盘] 获取文件下载 URL 失败
- GreaseMonkey 兼容 XMLHttpRequest 不可用。
AI-assisted analysis of hmjz100/LinkSwift@417ea5e28a (2026-09-02).
Data as JSON: /api/errors/17bc4fbc3c6ef1d0.
Report an issue: GitHub.