fix: show descriptive error when creating local user with OIDC enabled

Return a JSON error body from UserAdminController instead of an empty 400,
and extract API error messages in adminFetch so toasts display the reason.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-09 18:19:10 +02:00
parent 2771dffb78
commit be585934b9
3 changed files with 17 additions and 5 deletions

View File

@@ -145,8 +145,9 @@ export default function UsersTab({ highlightId, onHighlightConsumed }: { highlig
setNewPassword('');
setNewProvider('local');
},
onError: () => {
toast({ title: 'Failed to create user', variant: 'error', duration: 86_400_000 });
onError: (err: unknown) => {
const message = err instanceof Error ? err.message : 'Unknown error';
toast({ title: 'Failed to create user', description: message, variant: 'error', duration: 86_400_000 });
},
},
);