fix(api-key): preserve server errors after validation

This commit is contained in:
Taesu
2026-10-10 13:52:31 +09:00
parent 4cf1c5b4d0
commit 031f2da474
3 changed files with 39 additions and 10 deletions
+7 -5
View File
@@ -197,11 +197,13 @@ Otherwise if it throws, it will throw an `APIError`.
#### Result
| Outcome | Behavior |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------- |
| The key is accepted | Returns `valid: true`, the key details, and `error: null`. |
| The key is rejected | Returns `valid: false`, an error describing the rejection, and `key: null`. |
| Verification fails to complete | Throws an `APIError`, for example when a database connection fails. Handle this separately from a rejected key. |
`valid: true` means the key passed verification. Failures in best-effort storage updates are logged without changing the verification result.
| Outcome | Behavior |
| ------------------------------ | --------------------------------------------------------------------------------------- |
| The key is accepted | Returns `valid: true`, the key details, and `error: null`. |
| The key is rejected | Returns `valid: false`, an error describing the rejection, and `key: null`. |
| Verification fails to complete | Throws an `APIError` when a required verification step fails, such as a storage lookup. |
```ts
type Result = {