GeoLeaf Core API - v3.0.0
    Preparing search index...

    Function safeErrorHandler

    • Invokes a user-supplied error handler without letting it throw.

      A handler that fails while reporting a failure would replace the original error with its own — the classic way to lose the interesting one. Here both are logged and neither escapes. A missing or non-function handler is a no-op, so callers need no guard.

      Parameters

      • handler: ((err: unknown) => void) | undefined

        Optional callback; anything that is not a function is ignored.

      • error: unknown

        The error to hand to it.

      Returns void

      GeoLeaf.Errors.safeErrorHandler(onError, caughtError);