Skip to content

useMongocampError ​

Turns an error thrown by a MongoCamp API call into a displayable message.

ts
const { describeError } = useMongocampError()
const { kind, message } = describeError(error, 'nuxtUiMongocamp.databases.errorLoad')
kindWhen
networkThe generated client threw a FetchError — the server is unreachable, or the browser hid a rejected response (this is what an expired session looks like)
unauthorizedHTTP 401
forbiddenHTTP 403
otherAnything else; uses the error's own message, then the optional fallback i18n key, then nuxtUiMongocamp.errors.generic

Messages come from the nuxtUiMongocamp.errors.* locale keys (English and German).

Released under the MIT License.