The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix error handling
Steven Tey89beb983a546
diff --git a/apps/web/app/api/workspaces/[idOrSlug]/route.ts b/apps/web/app/api/workspaces/[idOrSlug]/route.tsindex 392f73d927..553d8c0c33 100644--- a/apps/web/app/api/workspaces/[idOrSlug]/route.ts+++ b/apps/web/app/api/workspaces/[idOrSlug]/route.ts@@ -212,7 +212,7 @@ export const PATCH = withWorkspace(if (error.code === "P2002") {throw new DubApiError({code: "conflict",- message: `The slug "${slug}" is already in use.`,+ message: `The ${ssoEmailDomain ? "email domain" : "slug"} "${ssoEmailDomain || slug}" is already in use.`,});} else {throw new DubApiError({diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/security/saml.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/security/saml.tsxindex 4f5bec4c1e..bb9f7bdf64 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/security/saml.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/settings/security/saml.tsx@@ -16,6 +16,7 @@ import { SAML_PROVIDERS } from "@dub/utils";import { Lock, ShieldOff } from "lucide-react";import { useMemo, useState } from "react";import { useForm } from "react-hook-form";+import { toast } from "sonner";type FormData = {ssoEmailDomain: string;@@ -95,15 +96,17 @@ export function SAML() {if (!response.ok) {const { error } = await response.json();- throw new Error(error.message || "Failed to update email domain.");+ toast.error(error.message);+ return;}// Reset form to mark as not dirtyawait mutate();reset(data);+ toast.success("Email domain updated successfully");} catch (error) {console.error("Error updating email domain:", error);- alert("Failed to update email domain. Please try again.");+ toast.error("Failed to update email domain. Please try again.");}};