mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
feat: add toUserMessage function for user-friendly error handling
This commit is contained in:
10
frontends/nextjs/src/lib/errors/to-user-message.ts
Normal file
10
frontends/nextjs/src/lib/errors/to-user-message.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { formatError } from './format-error'
|
||||
|
||||
/**
|
||||
* Convert error to user-friendly message (safe for display)
|
||||
* Strips stack traces and internal details
|
||||
*/
|
||||
export function toUserMessage(error: unknown): string {
|
||||
const formatted = formatError(error)
|
||||
return formatted.message || 'An unexpected error occurred'
|
||||
}
|
||||
Reference in New Issue
Block a user