arvo-core
    Preparing search index...

    Function isViolationError

    • Type guard to determine if an unknown value is a ViolationError, an instance of a class that inherits from ViolationError.

      Parameters

      • e: unknown

        The value to check, typically an unknown error or exception

      Returns boolean

      true if the value is a ViolationError, inherits from it, or has the isArvoViolationError flag, false otherwise

      const error = new ViolationError({
      type: 'RATE_LIMIT',
      message: 'API rate limit exceeded'
      });

      console.log(isViolationError(error)); // true
      console.log(isViolationError(new Error())); // false
      console.log(isViolationError(null)); // false