# safeActor

inline fun < T > CoroutineScope. safeActor (channelCapacity: Int = Channel.UNLIMITED, noinline onException: ExceptionHandler < Unit > = defaultSafelyExceptionHandler, crossinline block: suspend ( T ) -> Unit ): Channel< T >(source)

Creates a safe actor that catches and handles exceptions during message processing. This variant wraps the processing logic in a safety mechanism to prevent actor failure due to exceptions.

#### Return

A Channel that can be used to send messages to this actor

#### Parameters

channelCapacity

The capacity of the Channel used for message processing. Defaults to Channel.UNLIMITED

onException

Handler for exceptions that occur during message processing. Defaults to defaultSafelyExceptionHandler

block

The processing logic to be applied to each received message

#### Type Parameters

T

The type of messages this actor will process