- drupal_set_message(t('An error occurred while processing @operation with arguments : @args', array('@operation' => $error_operation[0], '@args' => print_r($error_operation[0], TRUE))));
+ \Drupal::service('messenger')
+ ->addMessage(t('An error occurred while processing @operation with arguments : @args'), [
+ '@operation' => $error_operation[0],
+ '@args' => print_r($error_operation[0]),
+ ]);