Newer
Older
navi-1 / webclient / src / components / settings / skills / errors.js
// api/index.js throws `METHOD path → status: body`; the body is FastAPI's JSON,
// whose `detail` is the sentence worth showing.
export function errorText(err) {
  const raw = String(err?.message || err)
  const match = /→\s*\d+:\s*([\s\S]*)$/.exec(raw)
  const body = match ? match[1] : raw
  try {
    const parsed = JSON.parse(body)
    return parsed.detail || body
  } catch {
    return body
  }
}