feat(timeline): map new ErrorCodes to localized messages
errors.ts ErrorCode union + getErrorMessage() cases for the four new codes,
with de/en/es i18n keys. Conflict messages are calm/recoverable
('...wurde zwischenzeitlich geändert. Bitte neu laden.'). Per #775.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -56,6 +56,9 @@ export type ErrorCode =
|
||||
| 'GESCHICHTE_TYPE_IMMUTABLE'
|
||||
| 'GESCHICHTE_TITLE_TOO_LONG'
|
||||
| 'GESCHICHTE_INTRO_TOO_LONG'
|
||||
| 'TIMELINE_EVENT_NOT_FOUND'
|
||||
| 'TIMELINE_EVENT_CONFLICT'
|
||||
| 'TIMELINE_TITLE_TOO_LONG'
|
||||
| 'INVALID_CREDENTIALS'
|
||||
| 'SESSION_EXPIRED'
|
||||
| 'MISSING_CREDENTIALS'
|
||||
@@ -66,6 +69,7 @@ export type ErrorCode =
|
||||
| 'VALIDATION_ERROR'
|
||||
| 'BATCH_TOO_LARGE'
|
||||
| 'BULK_EDIT_TOO_MANY_IDS'
|
||||
| 'CONFLICT'
|
||||
| 'INTERNAL_ERROR';
|
||||
|
||||
export interface BackendError {
|
||||
@@ -194,6 +198,12 @@ export function getErrorMessage(code: ErrorCode | string | undefined): string {
|
||||
return m.error_geschichte_title_too_long();
|
||||
case 'GESCHICHTE_INTRO_TOO_LONG':
|
||||
return m.error_geschichte_intro_too_long();
|
||||
case 'TIMELINE_EVENT_NOT_FOUND':
|
||||
return m.error_timeline_event_not_found();
|
||||
case 'TIMELINE_EVENT_CONFLICT':
|
||||
return m.error_timeline_event_conflict();
|
||||
case 'TIMELINE_TITLE_TOO_LONG':
|
||||
return m.error_timeline_title_too_long();
|
||||
case 'INVALID_CREDENTIALS':
|
||||
return m.error_invalid_credentials();
|
||||
case 'SESSION_EXPIRED':
|
||||
@@ -214,6 +224,8 @@ export function getErrorMessage(code: ErrorCode | string | undefined): string {
|
||||
return m.error_batch_too_large();
|
||||
case 'BULK_EDIT_TOO_MANY_IDS':
|
||||
return m.error_bulk_edit_too_many_ids();
|
||||
case 'CONFLICT':
|
||||
return m.error_conflict();
|
||||
default:
|
||||
return m.error_internal_error();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user