refactor: 简化后台表单中的 URL 别名错误提示文本
continuous-integration/drone/push Build is passing

This commit is contained in:
seahi committed 2026-08-15 14:16:10 +08:00
1 parent 54c1162d82
commit c9ca199fa5
5 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -117,7 +117,7 @@ export const actions: Actions = {
} }
console.error('Error creating category:', err); console.error('Error creating category:', err);
if ((err as any)?.message?.includes('UNIQUE constraint failed')) { if ((err as any)?.message?.includes('UNIQUE constraint failed')) {
return fail(400, { error: '分类名称或 URL 别名 (Slug) 已存在' }); return fail(400, { error: '分类名称或 URL 别名已存在' });
} }
return fail(500, { error: '创建分类失败' }); return fail(500, { error: '创建分类失败' });
} }
+1 -1
View File
@@ -59,7 +59,7 @@ export const actions: Actions = {
} catch (err: unknown) { } catch (err: unknown) {
console.error('Error updating page:', err); console.error('Error updating page:', err);
if ((err as any)?.message?.includes('UNIQUE constraint failed')) { if ((err as any)?.message?.includes('UNIQUE constraint failed')) {
return fail(400, { error: 'URL 别名 (Slug) 已被其他页面占用' }); return fail(400, { error: 'URL 别名已被其他页面占用' });
} }
return fail(500, { error: '保存修改失败' }); return fail(500, { error: '保存修改失败' });
} }
+1 -1
View File
@@ -32,7 +32,7 @@ export const actions: Actions = {
} catch (err: unknown) { } catch (err: unknown) {
console.error('Error creating page:', err); console.error('Error creating page:', err);
if ((err as any)?.message?.includes('UNIQUE constraint failed')) { if ((err as any)?.message?.includes('UNIQUE constraint failed')) {
return fail(400, { error: 'URL 别名 (Slug) 已被占用,请使用其他别名' }); return fail(400, { error: 'URL 别名已被占用,请使用其他别名' });
} }
return fail(500, { error: '保存页面失败' }); return fail(500, { error: '保存页面失败' });
} }
+1 -1
View File
@@ -166,7 +166,7 @@ export const actions: Actions = {
} catch (err: unknown) { } catch (err: unknown) {
console.error('Error updating post:', err); console.error('Error updating post:', err);
if (err instanceof Error && err.message.includes('UNIQUE constraint failed')) { if (err instanceof Error && err.message.includes('UNIQUE constraint failed')) {
return fail(400, { error: 'URL 别名 (Slug) 已被其他文章占用' }); return fail(400, { error: 'URL 别名已被其他文章占用' });
} }
return fail(500, { error: '保存修改失败' }); return fail(500, { error: '保存修改失败' });
} }
+1 -1
View File
@@ -107,7 +107,7 @@ export const actions: Actions = {
} catch (err: unknown) { } catch (err: unknown) {
console.error('Error creating post:', err); console.error('Error creating post:', err);
if (err instanceof Error && err.message.includes('UNIQUE constraint failed')) { if (err instanceof Error && err.message.includes('UNIQUE constraint failed')) {
return fail(400, { error: 'URL 别名 (Slug) 已被占用,请使用其他别名' }); return fail(400, { error: 'URL 别名已被占用,请使用其他别名' });
} }
return fail(500, { error: '保存文章失败' }); return fail(500, { error: '保存文章失败' });
} }