Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
Show descriptive permission error for block list and ignored domains
Cursor Agent9ab2e4bdf8b0
diff --git a/components/settings/global-block-list-form.tsx b/components/settings/global-block-list-form.tsxindex b2e4b4aa..43ce8277 100644--- a/components/settings/global-block-list-form.tsx+++ b/components/settings/global-block-list-form.tsx@@ -68,7 +68,7 @@ export default function GlobalBlockListForm() {}).then(async (res) => {if (!res.ok) {const { error } = await res.json();- throw new Error(error?.message || "Failed to update block list.");+ throw new Error(error || "Failed to update block list.");}await mutate();return res.json();diff --git a/components/settings/ignored-domains-form.tsx b/components/settings/ignored-domains-form.tsxindex c2a004de..c41b7fdb 100644--- a/components/settings/ignored-domains-form.tsx+++ b/components/settings/ignored-domains-form.tsx@@ -68,7 +68,7 @@ export default function IgnoredDomainsForm() {}).then(async (res) => {if (!res.ok) {const { error } = await res.json();- throw new Error(error?.message || "Failed to update ignored domains.");+ throw new Error(error || "Failed to update ignored domains.");}await mutate();return res.json();diff --git a/pages/api/teams/[teamId]/global-block-list.ts b/pages/api/teams/[teamId]/global-block-list.tsindex ca7ac5eb..90555ab0 100644--- a/pages/api/teams/[teamId]/global-block-list.ts+++ b/pages/api/teams/[teamId]/global-block-list.ts@@ -47,7 +47,9 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {if (req.method === "PUT") {if (teamAccess.role !== "ADMIN" && teamAccess.role !== "MANAGER") {- return res.status(403).json({ error: "Forbidden" });+ return res.status(403).json({+ error: "Only admins and managers can manage the block list.",+ });}try {diff --git a/pages/api/teams/[teamId]/ignored-domains.ts b/pages/api/teams/[teamId]/ignored-domains.tsindex c170d91a..73d8f814 100644--- a/pages/api/teams/[teamId]/ignored-domains.ts+++ b/pages/api/teams/[teamId]/ignored-domains.ts@@ -47,7 +47,9 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {if (req.method === "PUT") {if (teamAccess.role !== "ADMIN" && teamAccess.role !== "MANAGER") {- return res.status(403).json({ error: "Forbidden" });+ return res.status(403).json({+ error: "Only admins and managers can manage ignored domains.",+ });}try {