-
public final class ErrorHandlingKt
-
-
Method Summary
Modifier and Type Method Description final static UnitsetCustomExceptionHandler(Function1<Exception, Unit> handler)Sets a custom handler to manage exceptions. final static UnitsetCustomExceptionHandler(Function2<String, Exception, Unit> handler)Sets a custom handler to manage exceptions. final static UnitsetCustomExceptionHandler(Function3<Integer, String, Exception, Unit> handler)Sets a custom handler to manage exceptions. final static Unithandle(Exception $self, String tag, Integer severity)Handles an exception by executing the custom exception handler lambda passed to setCustomExceptionHandler. -
-
Method Detail
-
setCustomExceptionHandler
final static Unit setCustomExceptionHandler(Function1<Exception, Unit> handler)
Sets a custom handler to manage exceptions.
- Parameters:
handler- A lambda function that takes an exception of type Exception as input and performs custom exception handling.
-
setCustomExceptionHandler
final static Unit setCustomExceptionHandler(Function2<String, Exception, Unit> handler)
Sets a custom handler to manage exceptions.
- Parameters:
handler- A lambda function that takes an exception of type Exception as input and performs custom exception handling.
-
setCustomExceptionHandler
final static Unit setCustomExceptionHandler(Function3<Integer, String, Exception, Unit> handler)
Sets a custom handler to manage exceptions.
- Parameters:
handler- A lambda function that takes three parameters: The lambda function takes three parameters:A string representing the tag of the log message.
An integer representing the severity.
An exception of type Exception representing the exception that occurred.
-
handle
final static Unit handle(Exception $self, String tag, Integer severity)
Handles an exception by executing the custom exception handler lambda passed to setCustomExceptionHandler. If no custom handler is set, the exception is logged to Android's logcat.
- Parameters:
tag- An optional tag to identify the context of the log, can be null.severity- An optional severity level to indicate the importance of the log message, defaults to Log.ERROR.
-
-
-
-