Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

fix(ui): handle 404 policy error on upload without toast popup (#7254)

brios934ad180cb9c
diff --git a/frontend/editor/src/proprietary/components/policies/usePolicyAutoRun.ts b/frontend/editor/src/proprietary/components/policies/usePolicyAutoRun.ts
index e475d784ea..597136a32f 100644
--- a/frontend/editor/src/proprietary/components/policies/usePolicyAutoRun.ts
+++ b/frontend/editor/src/proprietary/components/policies/usePolicyAutoRun.ts
@@ -955,10 +955,14 @@ async function runPolicyOnFile(
error: null,
startedAt: Date.now(),
});
- } catch {
- // Dispatch failed (offline / backend error). Mark dispatched so we don't hammer;
+ } catch (err) {
+ // Dispatch failed (e.g. policy deleted/404 or backend offline). Mark dispatched so we don't hammer;
// the absent run simply won't appear in the activity feed. If the backend did
// start a run we never recorded, reconcileServerRuns rediscovers it.
+ console.debug(
+ `[PolicyAutoRun] Failed to dispatch policy ${categoryId} (${backendId}):`,
+ err,
+ );
markDispatched(categoryId, fileId);
} finally {
releaseDispatchSlot();
diff --git a/frontend/editor/src/proprietary/services/policyApi.ts b/frontend/editor/src/proprietary/services/policyApi.ts
index a10c7a8382..b0d78f36f7 100644
--- a/frontend/editor/src/proprietary/services/policyApi.ts
+++ b/frontend/editor/src/proprietary/services/policyApi.ts
@@ -73,6 +73,7 @@ export async function runStoredPolicy(
const res = await apiClient.post<JobResponse>(
`/api/v1/policies/${encodeURIComponent(id)}/run`,
form,
+ { suppressErrorToast: true },
);
return res.data.jobId;
}