diff --git a/frontend/providers/devbox/services/backend/response.ts b/frontend/providers/devbox/services/backend/response.ts index b78b5f1c362..44254e8ddd9 100644 --- a/frontend/providers/devbox/services/backend/response.ts +++ b/frontend/providers/devbox/services/backend/response.ts @@ -15,13 +15,21 @@ export const jsonRes = (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 { @@ -34,7 +42,7 @@ export const jsonRes = (props: { } console.log('===jsonRes===\n', error) } - if(code >= 500) { + if (code >= 500) { return NextResponse.json({ code, statusText: '', diff --git a/frontend/providers/devbox/utils/vaildate.ts b/frontend/providers/devbox/utils/vaildate.ts index b02002e5e3c..a59c4d7c9b5 100644 --- a/frontend/providers/devbox/utils/vaildate.ts +++ b/frontend/providers/devbox/utils/vaildate.ts @@ -7,7 +7,7 @@ export const versionSchema = z.string().min(1).regex(/[\w][\w.-]{0,127}/, { message: versionErrorEnum.INVALID_VERSION, }); export const templateNameSchema = z.string().regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/); -export const devboxNameSchema = z.string().regex(/^[a-z]([-a-z0-9]*[a-z0-9])?/); +export const devboxNameSchema = z.string().regex(/^[a-z]([-a-z0-9]*[a-z0-9])?$/); export const createTemplateRepositorySchema = z.object({ description: z.string().max(255), version: z.string().min(1).max(255),