# callSafely method

void callSafely(

1. T value, {
2. String message()?,

})

Executes the consumer with exception handling and custom error messaging.

Wraps the consumer execution in a try-catch block and provides meaningful error messages when exceptions occur.

`value` the value to pass to the consumer `message` optional function to generate custom error messages

Throws:

- IllegalStateException if the consumer throws an exception

Example:

    consumer.callSafely('test', message: () => 'Failed to process value');

## Implementation

    void callSafely(T value, {String Function()? message}) {
      try {
        this(value);
      } catch (ex) {
        throw IllegalStateException(
          message?.call() ?? "Execution of ${T.runtimeType} failed",
          cause: ex,
        );
      }
    }