Skip to content

Commit

Permalink
fix(devbox): fix show error
Browse files Browse the repository at this point in the history
  • Loading branch information
xudaotutou committed Jan 10, 2025
1 parent 0ec7f2b commit 10db0d1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions frontend/providers/devbox/services/backend/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@ export const jsonRes = <T = any>(props: {
return NextResponse.json(ERROR_RESPONSE[error])
}
const body = error?.body
if(body instanceof V1Status && body.message?.includes('40001:')) {
return NextResponse.json(ERROR_RESPONSE[ERROR_ENUM.outstandingPayment])
if (body instanceof V1Status) {
if (body.message?.includes('40001:')) {
return NextResponse.json(ERROR_RESPONSE[ERROR_ENUM.outstandingPayment])
} else {
return NextResponse.json({
code: 500,
statusText: body.message,
message: body.message,
})
}
}

let msg = message
if ((code < 200 || code >= 400) && !message) {
if(code >= 500) {
if (code >= 500) {
console.log(error)
msg = 'Internal Server Error'
} else {
Expand All @@ -34,7 +42,7 @@ export const jsonRes = <T = any>(props: {
}
console.log('===jsonRes===\n', error)
}
if(code >= 500) {
if (code >= 500) {
return NextResponse.json({
code,
statusText: '',
Expand Down

0 comments on commit 10db0d1

Please sign in to comment.