Unify the dashboard experience and retire the multi-theme engine so onboarding and day-to-day invoicing feel consistent and easier to maintain.
Shared layout, tabs, and sidebar timer; user onboarding and registration polish; settings danger zone and data export; chart and tRPC perf fixes; migrations for onboarding and dropped appearance columns. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
const DATABASE_SETUP_HINT =
|
||||
"Database not ready — run `bun db:migrate` (or `bun db:push` for local dev) after starting Postgres.";
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
function collectErrorParts(error: unknown): string[] {
|
||||
const parts: string[] = [];
|
||||
const seen = new Set<unknown>();
|
||||
let current: unknown = error;
|
||||
|
||||
while (current && isRecord(current) && !seen.has(current)) {
|
||||
seen.add(current);
|
||||
|
||||
if (typeof current.message === "string") {
|
||||
parts.push(current.message);
|
||||
}
|
||||
|
||||
if (typeof current.code === "string") {
|
||||
parts.push(current.code);
|
||||
}
|
||||
|
||||
current = current.cause;
|
||||
}
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
export function getDatabaseSetupErrorMessage(error: unknown): string | null {
|
||||
const haystack = collectErrorParts(error).join(" ").toLowerCase();
|
||||
|
||||
if (
|
||||
haystack.includes("does not exist") ||
|
||||
haystack.includes("42p01") ||
|
||||
haystack.includes("econnrefused") ||
|
||||
haystack.includes("connection refused") ||
|
||||
haystack.includes("connect econnrefused")
|
||||
) {
|
||||
return DATABASE_SETUP_HINT;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user