feat: enhance user experience with new components and improved error handling. Introduce ErrorFallback component for better error display, add pagination for admin content management, and implement dialogs for test session management. Update routing to include new components and improve accessibility with ARIA attributes. Refactor question formats and integrate debounced search functionality for admin features.
4c7b844 Download apps/web/src/lib/error-utils.ts from Atmint/cpns: direct link, hf CLI and curl.
- Browser
- Download file 549 Bytes
-
https://huggingface.co/spaces/Atmint/cpns/resolve/main/apps/web/src/lib/error-utils.ts
- Command line
-
hf download hf://spaces/Atmint/cpns/apps/web/src/lib/error-utils.ts
-
curl -L -o error-utils.ts https://huggingface.co/spaces/Atmint/cpns/resolve/main/apps/web/src/lib/error-utils.ts
549 Bytes
| /** Extract a human-readable message from an unknown error value. | |
| * Safe to use in tRPC `onError` callbacks where the error type is `unknown`. */ | |
| export function getErrorMessage(err: unknown): string { | |
| if (err instanceof Error) return err.message; | |
| if (typeof err === "string") return err; | |
| if ( | |
| err && | |
| typeof err === "object" && | |
| "message" in err && | |
| typeof (err as Record<string, unknown>).message === "string" | |
| ) { | |
| return (err as Record<string, unknown>).message as string; | |
| } | |
| return "An unexpected error occurred"; | |
| } | |