diff --git a/src/lib/utils/server.ts b/src/lib/utils/server.ts index 345b9ad54..4aca4ab6a 100644 --- a/src/lib/utils/server.ts +++ b/src/lib/utils/server.ts @@ -63,7 +63,13 @@ export async function generateE2BUserAccessToken(supabaseAccessToken: string) { }) if (res.error) { - logError(ERROR_CODES.INFRA, '/access-tokens', res.error, res.data) + logError( + ERROR_CODES.INFRA, + '/access-tokens', + res.response.status, + res.error, + res.data + ) return returnServerError(`Failed to generate e2b user access token`) } diff --git a/src/server/keys/get-api-keys.ts b/src/server/keys/get-api-keys.ts index 15cf75039..349266669 100644 --- a/src/server/keys/get-api-keys.ts +++ b/src/server/keys/get-api-keys.ts @@ -28,8 +28,8 @@ export const getTeamApiKeys = authActionClient }) if (res.error) { - const status = res.error?.code ?? 500 - logError(ERROR_CODES.INFRA, '/api-keys', res.error) + const status = res.response.status + logError(ERROR_CODES.INFRA, '/api-keys', status, res.error, res.data) return handleDefaultInfraError(status) } diff --git a/src/server/sandboxes/get-sandbox-details.ts b/src/server/sandboxes/get-sandbox-details.ts index 8be8440dd..c551ad3b5 100644 --- a/src/server/sandboxes/get-sandbox-details.ts +++ b/src/server/sandboxes/get-sandbox-details.ts @@ -30,9 +30,15 @@ export const getSandboxDetails = authActionClient }) if (res.error) { - const status = res.error?.code ?? 500 - - logError(ERROR_CODES.INFRA, '/sandboxes/{sandboxID}', res.error, res.data) + const status = res.response.status + + logError( + ERROR_CODES.INFRA, + '/sandboxes/{sandboxID}', + status, + res.error, + res.data + ) if (status === 404) { return returnServerError( diff --git a/src/server/sandboxes/get-team-sandboxes.ts b/src/server/sandboxes/get-team-sandboxes.ts index 098699fad..67ab2f20e 100644 --- a/src/server/sandboxes/get-team-sandboxes.ts +++ b/src/server/sandboxes/get-team-sandboxes.ts @@ -39,9 +39,9 @@ export const getTeamSandboxes = authActionClient }) if (res.error) { - const status = res.error?.code ?? 500 + const status = res.response.status - logError(ERROR_CODES.INFRA, '/sandboxes', res.error, res.data) + logError(ERROR_CODES.INFRA, '/sandboxes', status, res.error, res.data) return handleDefaultInfraError(status) } diff --git a/src/server/templates/get-team-templates.ts b/src/server/templates/get-team-templates.ts index 0eed0083a..0cbfc6e36 100644 --- a/src/server/templates/get-team-templates.ts +++ b/src/server/templates/get-team-templates.ts @@ -44,8 +44,8 @@ export const getTeamTemplates = authActionClient }) if (res.error) { - const status = res.error?.code ?? 500 - logError(ERROR_CODES.INFRA, '/templates', res.error, res.data) + const status = res.response.status + logError(ERROR_CODES.INFRA, '/templates', status, res.error, res.data) return handleDefaultInfraError(status) } diff --git a/src/server/templates/templates-actions.ts b/src/server/templates/templates-actions.ts index 18ac83018..8f92a8084 100644 --- a/src/server/templates/templates-actions.ts +++ b/src/server/templates/templates-actions.ts @@ -31,10 +31,11 @@ export const deleteTemplateAction = authActionClient }) if (res.error) { - const status = res.error?.code ?? 500 + const status = res.response.status logError( ERROR_CODES.INFRA, '/templates/{templateID}', + status, res.error, res.data ) @@ -91,8 +92,14 @@ export const updateTemplateAction = authActionClient }) if (res.error) { - const status = res.error?.code ?? 500 - logError(ERROR_CODES.INFRA, '/templates/{templateID}', res.error) + const status = res.response.status + logError( + ERROR_CODES.INFRA, + '/templates/{templateID}', + status, + res.error, + res.data + ) if (status === 404) { return returnServerError('Template not found')