Interface ErrorHandlingStrategy

    • Method Detail

      • handleMissingValue

        <T> T handleMissingValue​(String path,
                                 T defaultValue)
        This handler is invoked when a value cannot be resolved from a path. This happens when value is not present or null.
        Type Parameters:
        T - Type of default Value
        Parameters:
        path - Path for which value was not found
        defaultValue - Default value to be returned if present
        Returns:
        defaultValue or exception depending on implementation
      • handleTypeMismatch

        <T> T handleTypeMismatch​(String path,
                                 String expected,
                                 String actual,
                                 T defaultValue)
        This handler is invoked when there is type mismatch between value at path and that present in json.
        Type Parameters:
        T - Type of defaultValue
        Parameters:
        path - Path for which value mismatch was detected
        expected - Expected type
        actual - Type found in provided json
        defaultValue - Default value to be returned in case of mismatch
        Returns:
        defaultValue or throws exception depending on implementation
      • paramValidationFailure

        default void paramValidationFailure​(String checkFailureMessage)
        This handler is invoked when param evaluation in a HopeFunction evaluation fails
        Parameters:
        checkFailureMessage - Message describing the failure
      • handleIllegalEval

        <T> T handleIllegalEval​(String message,
                                T defaultValue)
        This handler is called in case there is some bug in the evaluation. This should never be raised faced in production. In case this happens it is a bug that should be reported.
        Type Parameters:
        T - Type of defaultValue
        Parameters:
        message - Custom message provided at assertion site
        defaultValue - Default value to be returned if this state is faced
        Returns:
        defaultValue or throws exception depending on implementation