safeClose static method

Future<void> safeClose(
  1. Future<void> closeOperation(),
  2. String resourceName
)

Safely closes a resource with error handling

Implementation

static Future<void> safeClose(
  Future<void> Function() closeOperation,
  String resourceName,
) async {
  try {
    await closeOperation();
    _logger.fine('[UDXExceptionUtils] Successfully closed $resourceName');
  } catch (error) {
    _logger.warning('[UDXExceptionUtils] Error closing $resourceName: $error');
    // Don't rethrow - we want cleanup to continue
  }
}