Skip to content

Commit e44e841

Browse files
waleedlatif1claude
andcommitted
fix(google_drive): include HTTP status in fallback error messages
Address greptile review on PR #4345: when Google Drive returns a non-JSON error body, surface the response status/statusText so failures are diagnosable instead of falling through to a generic message. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 02fca0e commit e44e841

4 files changed

Lines changed: 16 additions & 4 deletions

File tree

apps/sim/tools/google_drive/copy.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ export const copyTool: ToolConfig<GoogleDriveCopyParams, GoogleDriveCopyResponse
8080
const data = await response.json().catch(() => ({}) as any)
8181

8282
if (!response.ok) {
83-
throw new Error(data.error?.message || 'Failed to copy Google Drive file')
83+
throw new Error(
84+
data.error?.message ||
85+
`Failed to copy Google Drive file (${response.status} ${response.statusText})`
86+
)
8487
}
8588

8689
return {

apps/sim/tools/google_drive/delete.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ export const deleteTool: ToolConfig<GoogleDriveDeleteParams, GoogleDriveDeleteRe
5353
transformResponse: async (response: Response, params) => {
5454
if (!response.ok) {
5555
const data = await response.json().catch(() => ({}) as any)
56-
throw new Error(data.error?.message || 'Failed to delete Google Drive file')
56+
throw new Error(
57+
data.error?.message ||
58+
`Failed to delete Google Drive file (${response.status} ${response.statusText})`
59+
)
5760
}
5861

5962
return {

apps/sim/tools/google_drive/get_file.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ export const getFileTool: ToolConfig<GoogleDriveGetFileParams, GoogleDriveGetFil
5555
const data = await response.json().catch(() => ({}) as any)
5656

5757
if (!response.ok) {
58-
throw new Error(data.error?.message || 'Failed to get Google Drive file')
58+
throw new Error(
59+
data.error?.message ||
60+
`Failed to get Google Drive file (${response.status} ${response.statusText})`
61+
)
5962
}
6063

6164
return {

apps/sim/tools/google_drive/update.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ export const updateTool: ToolConfig<GoogleDriveUpdateParams, GoogleDriveUpdateRe
110110
const data = await response.json().catch(() => ({}) as any)
111111

112112
if (!response.ok) {
113-
throw new Error(data.error?.message || 'Failed to update Google Drive file')
113+
throw new Error(
114+
data.error?.message ||
115+
`Failed to update Google Drive file (${response.status} ${response.statusText})`
116+
)
114117
}
115118

116119
return {

0 commit comments

Comments
 (0)