Skip to content

Commit 4880038

Browse files
committed
fix: use correct response status code from infra oapi client
1 parent 3c1f1cf commit 4880038

5 files changed

Lines changed: 25 additions & 12 deletions

File tree

src/server/keys/get-api-keys.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export const getTeamApiKeys = authActionClient
2828
})
2929

3030
if (res.error) {
31-
const status = res.error?.code ?? 500
32-
logError(ERROR_CODES.INFRA, '/api-keys', res.error)
31+
const status = res.response.status
32+
logError(ERROR_CODES.INFRA, '/api-keys', res.error, res.data)
3333

3434
return handleDefaultInfraError(status)
3535
}

src/server/sandboxes/get-sandbox-details.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,15 @@ export const getSandboxDetails = authActionClient
3030
})
3131

3232
if (res.error) {
33-
const status = res.error?.code ?? 500
34-
35-
logError(ERROR_CODES.INFRA, '/sandboxes/{sandboxID}', res.error, res.data)
33+
const status = res.response.status
34+
35+
logError(
36+
ERROR_CODES.INFRA,
37+
'/sandboxes/{sandboxID}',
38+
status,
39+
res.error,
40+
res.data
41+
)
3642

3743
if (status === 404) {
3844
return returnServerError(

src/server/sandboxes/get-team-sandboxes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ export const getTeamSandboxes = authActionClient
3939
})
4040

4141
if (res.error) {
42-
const status = res.error?.code ?? 500
42+
const status = res.response.status
4343

44-
logError(ERROR_CODES.INFRA, '/sandboxes', res.error, res.data)
44+
logError(ERROR_CODES.INFRA, '/sandboxes', status, res.error, res.data)
4545

4646
return handleDefaultInfraError(status)
4747
}

src/server/templates/get-team-templates.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export const getTeamTemplates = authActionClient
4444
})
4545

4646
if (res.error) {
47-
const status = res.error?.code ?? 500
48-
logError(ERROR_CODES.INFRA, '/templates', res.error, res.data)
47+
const status = res.response.status
48+
logError(ERROR_CODES.INFRA, '/templates', status, res.error, res.data)
4949

5050
return handleDefaultInfraError(status)
5151
}

src/server/templates/templates-actions.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ export const deleteTemplateAction = authActionClient
3131
})
3232

3333
if (res.error) {
34-
const status = res.error?.code ?? 500
34+
const status = res.response.status
3535
logError(
3636
ERROR_CODES.INFRA,
3737
'/templates/{templateID}',
38+
status,
3839
res.error,
3940
res.data
4041
)
@@ -91,8 +92,14 @@ export const updateTemplateAction = authActionClient
9192
})
9293

9394
if (res.error) {
94-
const status = res.error?.code ?? 500
95-
logError(ERROR_CODES.INFRA, '/templates/{templateID}', res.error)
95+
const status = res.response.status
96+
logError(
97+
ERROR_CODES.INFRA,
98+
'/templates/{templateID}',
99+
status,
100+
res.error,
101+
res.data
102+
)
96103

97104
if (status === 404) {
98105
return returnServerError('Template not found')

0 commit comments

Comments
 (0)