Hiyve Components - v1.0.0
    Preparing search index...
    • Maps raw Hiyve error messages to user-friendly strings.

      Parameters

      • error: string | Error

        The raw error string or Error object

      • OptionalcustomMessages: Record<string, string>

        Optional mappings that override or extend the defaults

      Returns string

      A user-friendly error message

      Pure function — no side effects. Performs case-insensitive substring matching against the provided (or default) message map. Returns the original error string if no mapping matches.

      import { formatHiyveError } from '@hiyve/utilities';

      <HiyveProvider
      onError={(err) => setError(formatHiyveError(err.message || String(err)))}
      >

      With custom messages:

      const friendly = formatHiyveError(error, {
      'rate limit': 'Slow down! Try again in a few seconds.',
      });