Package 

Object StandardErrorHandler


  • 
    public class StandardErrorHandler
    
                        

    Project Name: OSMOS-Android-SDK File Name: StandardErrorHandler

    Centralized error handling utility that provides consistent error handling patterns across all SDK classes. This reduces code duplication and ensures uniform error management.

    • Method Detail

      • executeWithErrorHandling

         final <T extends Any> T executeWithErrorHandling(ErrorCallback errorCallback, SuspendFunction0<T> operation)

        Executes a suspend function with standardized error handling.

        Parameters:
        errorCallback - Optional callback to handle errors
        operation - The suspend function to execute
      • validateConfiguration

         final Unit validateConfiguration(Function0<Object> configCheck, OsmosError error)

        Validates configuration and throws appropriate exception if not configured.

        Parameters:
        configCheck - Function that checks if configuration exists
        error - The error to throw if configuration is missing
      • executeWithParsingErrorHandling

         final <T extends Any> T executeWithParsingErrorHandling(Function0<T> operation)

        Wraps parsing operations with consistent error handling.

        Parameters:
        operation - The parsing operation to execute