The footer was a user card with the theme picker and log out buried in its dropdown. It is now two plain entries, Settings and Log Out, and the theme moved into the settings page as its own tab. The dark sidebar never matched the canvas because _canvas.tsx painted bg-card across the whole viewport underneath it, so the floating panel's bg-card/80 resolved to card over card and its gutter was card too. Nothing there should paint a surface; the panel now reads the same as the other frosted chrome. The superuser guard sliced the first three tabs, which silently changed meaning when a fourth arrived. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KkmeRiyeYmVZqJVwuyHq9o
23 lines
540 B
TypeScript
23 lines
540 B
TypeScript
import { AxiosError } from "axios"
|
|
import type { ApiError } from "./client"
|
|
|
|
function extractErrorMessage(err: ApiError): string {
|
|
if (err instanceof AxiosError) {
|
|
return err.message
|
|
}
|
|
|
|
const errDetail = (err.body as any)?.detail
|
|
if (Array.isArray(errDetail) && errDetail.length > 0) {
|
|
return errDetail[0].msg
|
|
}
|
|
return errDetail || "Something went wrong."
|
|
}
|
|
|
|
export const handleError = function (
|
|
this: (msg: string) => void,
|
|
err: ApiError,
|
|
) {
|
|
const errorMessage = extractErrorMessage(err)
|
|
this(errorMessage)
|
|
}
|