diff --git a/apps/builder/src/features/customDomains/api/createCustomDomain.ts b/apps/builder/src/features/customDomains/api/createCustomDomain.ts index 960b50da3..21c03b939 100644 --- a/apps/builder/src/features/customDomains/api/createCustomDomain.ts +++ b/apps/builder/src/features/customDomains/api/createCustomDomain.ts @@ -65,6 +65,7 @@ export const createCustomDomain = authenticatedProcedure throw new TRPCError({ code: 'INTERNAL_SERVER_ERROR', message: 'Failed to create custom domain on Vercel', + cause: await err.response.text(), }) } } diff --git a/apps/builder/src/features/customDomains/api/deleteCustomDomain.ts b/apps/builder/src/features/customDomains/api/deleteCustomDomain.ts index bfc290195..33b6699bb 100644 --- a/apps/builder/src/features/customDomains/api/deleteCustomDomain.ts +++ b/apps/builder/src/features/customDomains/api/deleteCustomDomain.ts @@ -2,7 +2,7 @@ import prisma from '@typebot.io/lib/prisma' import { authenticatedProcedure } from '@/helpers/server/trpc' import { TRPCError } from '@trpc/server' import { z } from 'zod' -import ky from 'ky' +import ky, { HTTPError } from 'ky' import { env } from '@typebot.io/env' import { isWriteWorkspaceForbidden } from '@/features/workspace/helpers/isWriteWorkspaceForbidden' @@ -47,10 +47,17 @@ export const deleteCustomDomain = authenticatedProcedure await deleteDomainOnVercel(name) } catch (error) { console.error(error) - throw new TRPCError({ - code: 'INTERNAL_SERVER_ERROR', - message: 'Failed to delete domain on Vercel', - }) + if (error instanceof HTTPError) + throw new TRPCError({ + code: 'INTERNAL_SERVER_ERROR', + message: 'Failed to delete domain on Vercel', + cause: await error.response.text(), + }) + else + throw new TRPCError({ + code: 'INTERNAL_SERVER_ERROR', + message: 'Failed to delete domain on Vercel', + }) } await prisma.customDomain.deleteMany({ where: {