-
public class StandardErrorHandlerProject 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.
-
-
Field Summary
Fields Modifier and Type Field Description public final static StandardErrorHandlerINSTANCE
-
Method Summary
Modifier and Type Method Description final <T extends Any> TexecuteWithErrorHandling(ErrorCallback errorCallback, SuspendFunction0<T> operation)Executes a suspend function with standardized error handling. final UnitvalidateConfiguration(Function0<Object> configCheck, OsmosError error)Validates configuration and throws appropriate exception if not configured. final <T extends Any> TexecuteWithParsingErrorHandling(Function0<T> operation)Wraps parsing operations with consistent error handling. -
-
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 errorsoperation- 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 existserror- 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
-
-
-
-