























@@ -103,24 +103,29 @@ export function registerBrowserFilesAndDownloadsCommands(
103103(v: string) => Number(v),
104104)
105105.action(async (paths: string[], opts, cmd) => {
106-const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
107-const normalizedPaths = await normalizeUploadPaths(paths);
108-const { timeoutMs, targetId } = resolveTimeoutAndTarget(opts);
109-await runBrowserPostAction({
110- parent,
111- profile,
112-path: "/hooks/file-chooser",
113-body: {
114-paths: normalizedPaths,
115-ref: normalizeOptionalString(opts.ref),
116-inputRef: normalizeOptionalString(opts.inputRef),
117-element: normalizeOptionalString(opts.element),
118- targetId,
119- timeoutMs,
120-},
121-timeoutMs: timeoutMs ?? DEFAULT_BROWSER_HOOK_TIMEOUT_MS,
122-describeSuccess: () => `upload armed for ${paths.length} file(s)`,
123-});
106+try {
107+const { parent, profile } = resolveBrowserActionContext(cmd, parentOpts);
108+const normalizedPaths = await normalizeUploadPaths(paths);
109+const { timeoutMs, targetId } = resolveTimeoutAndTarget(opts);
110+await runBrowserPostAction({
111+ parent,
112+ profile,
113+path: "/hooks/file-chooser",
114+body: {
115+paths: normalizedPaths,
116+ref: normalizeOptionalString(opts.ref),
117+inputRef: normalizeOptionalString(opts.inputRef),
118+element: normalizeOptionalString(opts.element),
119+ targetId,
120+ timeoutMs,
121+},
122+timeoutMs: timeoutMs ?? DEFAULT_BROWSER_HOOK_TIMEOUT_MS,
123+describeSuccess: () => `upload armed for ${paths.length} file(s)`,
124+});
125+} catch (err) {
126+defaultRuntime.error(danger(String(err)));
127+defaultRuntime.exit(1);
128+}
124129});
125130126131browser
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。