More verbose error message

This commit is contained in:
Adria Navarro 2025-03-18 18:32:21 +01:00
parent a78d0c0a64
commit 0d0ff801fa
2 changed files with 7 additions and 2 deletions

View File

@ -151,7 +151,9 @@ describe("/oauth2", () => {
}, },
{ {
status: 400, status: 400,
body: { message: "Name is not available." }, body: {
message: `OAuth2 config with name '${config2.name}' is already taken.`,
},
} }
) )
}) })

View File

@ -65,7 +65,10 @@ export async function update(config: OAuth2Config): Promise<OAuth2Config> {
c => c.name === config.name && c.id !== config.id c => c.name === config.name && c.id !== config.id
) )
) { ) {
throw new HTTPError("Name is not available.", 400) throw new HTTPError(
`OAuth2 config with name '${config.name}' is already taken.`,
400
)
} }
doc.configs[config.id] = { doc.configs[config.id] = {