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

    Function createError

    • Builds a typed error whose stack starts at the caller, not inside this helper.

      The only reason to prefer this over new ValidationError(...): captureStackTrace elides this frame, so the top of the stack is the code that decided to fail. Without it, every error built through a factory points at the factory.

      Parameters

      • ErrorClass: ErrorClassConstructor

        Constructor to instantiate.

      • message: string

        Error message.

      • context: ErrorContext = {}

        Structured context attached to the instance. Defaults to {}.

      Returns GeoLeafError

      The constructed error, not thrown.

      const err = GeoLeaf.Errors.createError(GeoLeaf.Errors.ValidationError, "Invalid zoom level", {
      zoom: 25,
      max: 20,
      });