You are here

function acquia_connector_connection_error_message in Acquia Connector 8.2

Same name and namespace in other branches
  1. 8 acquia_connector.module \acquia_connector_connection_error_message()
  2. 3.x acquia_connector.module \acquia_connector_connection_error_message()

Return an error message by the error code.

Returns an error message for the most recent (failed) attempt to connect to the Acquia during the current page request. If there were no failed attempts, returns FALSE.

This function assumes that the most recent error came from the Acquia; otherwise, it will not work correctly.

Parameters

int $errno: Error code defined by the module.

Return value

mixed The error message string or FALSE.

1 call to acquia_connector_connection_error_message()
SettingsForm::buildForm in src/Form/SettingsForm.php
Form constructor.

File

./acquia_connector.module, line 250
Acquia Connector module.

Code

function acquia_connector_connection_error_message($errno) {
  if ($errno) {
    switch ($errno) {
      case Subscription::NOT_FOUND:
        return t('The identifier you have provided does not exist at Acquia or is expired. Please make sure you have used the correct value and try again.');
      case Subscription::EXPIRED:
        return t('Your Acquia Subscription subscription has expired. Please renew your subscription so that you can resume using Acquia services.');
      case Subscription::MESSAGE_FUTURE:
        return t('Your server is unable to communicate with Acquia due to a problem with your clock settings. For security reasons, we reject messages that are more than @time ahead of the actual time recorded by our servers. Please fix the clock on your server and try again.', [
          '@time' => \Drupal::service('date.formatter')
            ->formatInterval(Subscription::MESSAGE_LIFETIME),
        ]);
      case Subscription::MESSAGE_EXPIRED:
        return t('Your server is unable to communicate with Acquia due to a problem with your clock settings. For security reasons, we reject messages that are more than @time older than the actual time recorded by our servers. Please fix the clock on your server and try again.', [
          '@time' => \Drupal::service('date.formatter')
            ->formatInterval(Subscription::MESSAGE_LIFETIME),
        ]);
      case Subscription::VALIDATION_ERROR:
        return t('The identifier and key you have provided for the Acquia Subscription do not match. Please make sure you have used the correct values and try again.');
      default:
        return t('There is an error communicating with the Acquia Subscription at this time. Please check your identifier and key and try again.');
    }
  }
  return FALSE;
}