UNPKG

@yobta/validator

Version:
9 lines (8 loc) 320 B
import { YobtaError } from '../../YobtaError/index.js'; export const handleUnknownError = ({ error, field, path, }) => { if (error instanceof YobtaError) { return error; } const message = error instanceof Error ? error.message : String(error); return new YobtaError({ field, message, path }); };