fix(settings): the client registration form says what the server refused

Registering an OAuth client by hand and getting only "Failed to register
OAuth client" left nothing to act on: the server names the rule it broke (a
scope, the ten-client cap, a redirect URI it will not take) and the toast
swallowed it in a bare catch. Both shells show the server's message now and
keep the generic text for a failure that carries none.
This commit is contained in:
Maurice
2026-09-22 11:55:43 +02:00
parent da32eb8a3c
commit b0c19bfac1
4 changed files with 36 additions and 11 deletions
@@ -11,6 +11,7 @@ import MChip from '../../components/MChip'
import { MSetCard, MSetEyebrow, MSetInput, MSetTextarea, MSetButton, MSetHint, MSetRow } from './MSettingsUi'
import MConfirmSheet from './MConfirmSheet'
import MSegmented from '../../components/MSegmented'
import { getApiErrorMessage } from '../../../utils/apiError'
interface OAuthPreset {
id: string
@@ -188,8 +189,11 @@ export default function MSettingsMcp() {
setNewUris('')
setNewScopes([])
setIsMachine(false)
} catch {
toast.error(t('settings.oauth.toast.createError'))
} catch (err) {
// The server names the rule that refused the client (a scope, the
// ten-client cap, a redirect URI it will not take); swallowing it left
// "Failed to register OAuth client" and nothing to act on.
toast.error(getApiErrorMessage(err, t('settings.oauth.toast.createError')))
} finally {
setCreating(false)
}