Skip to content

Commit 088cf23

Browse files
waleedlatif1claude
andcommitted
fix(api): add success:false to ZodError responses for consistency
7 routes used { success: false, error: ... } in their generic error handler but our ZodError handler only returned { error: ... }. Aligned the ZodError response shape to match. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 912033f commit 088cf23

File tree

8 files changed

+7
-11
lines changed

8 files changed

+7
-11
lines changed

apps/sim/app/api/tools/google_drive/download/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ export async function POST(request: NextRequest) {
242242
} catch (error) {
243243
if (error instanceof z.ZodError) {
244244
return NextResponse.json(
245-
{ error: error.errors[0]?.message ?? 'Invalid request' },
245+
{ success: false, error: error.errors[0]?.message ?? 'Invalid request' },
246246
{ status: 400 }
247247
)
248248
}

apps/sim/app/api/tools/onedrive/download/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export async function POST(request: NextRequest) {
167167
} catch (error) {
168168
if (error instanceof z.ZodError) {
169169
return NextResponse.json(
170-
{ error: error.errors[0]?.message ?? 'Invalid request' },
170+
{ success: false, error: error.errors[0]?.message ?? 'Invalid request' },
171171
{ status: 400 }
172172
)
173173
}

apps/sim/app/api/tools/outlook/draft/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export async function POST(request: NextRequest) {
178178
} catch (error) {
179179
if (error instanceof z.ZodError) {
180180
return NextResponse.json(
181-
{ error: error.errors[0]?.message ?? 'Invalid request' },
181+
{ success: false, error: error.errors[0]?.message ?? 'Invalid request' },
182182
{ status: 400 }
183183
)
184184
}

apps/sim/app/api/tools/outlook/send/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export async function POST(request: NextRequest) {
191191
} catch (error) {
192192
if (error instanceof z.ZodError) {
193193
return NextResponse.json(
194-
{ error: error.errors[0]?.message ?? 'Invalid request' },
194+
{ success: false, error: error.errors[0]?.message ?? 'Invalid request' },
195195
{ status: 400 }
196196
)
197197
}

apps/sim/app/api/tools/slack/download/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export async function POST(request: NextRequest) {
160160
} catch (error) {
161161
if (error instanceof z.ZodError) {
162162
return NextResponse.json(
163-
{ error: error.errors[0]?.message ?? 'Invalid request' },
163+
{ success: false, error: error.errors[0]?.message ?? 'Invalid request' },
164164
{ status: 400 }
165165
)
166166
}

apps/sim/app/api/tools/slack/send-ephemeral/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export async function POST(request: NextRequest) {
8686
} catch (error) {
8787
if (error instanceof z.ZodError) {
8888
return NextResponse.json(
89-
{ error: error.errors[0]?.message ?? 'Invalid request' },
89+
{ success: false, error: error.errors[0]?.message ?? 'Invalid request' },
9090
{ status: 400 }
9191
)
9292
}

apps/sim/app/api/tools/slack/send-message/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export async function POST(request: NextRequest) {
7979
} catch (error) {
8080
if (error instanceof z.ZodError) {
8181
return NextResponse.json(
82-
{ error: error.errors[0]?.message ?? 'Invalid request' },
82+
{ success: false, error: error.errors[0]?.message ?? 'Invalid request' },
8383
{ status: 400 }
8484
)
8585
}

apps/sim/app/workspace/[workspaceId]/home/home.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,6 @@ export function Home({ chatId }: HomeProps = {}) {
273273
return context.tableId ? { type: 'table', id: context.tableId } : null
274274
case 'file':
275275
return context.fileId ? { type: 'file', id: context.fileId } : null
276-
case 'folder':
277-
return context.folderId ? { type: 'folder', id: context.folderId } : null
278-
case 'past_chat':
279-
return context.chatId ? { type: 'task', id: context.chatId } : null
280276
default:
281277
return null
282278
}

0 commit comments

Comments
 (0)