You are here

public function ConnectorException::getCustomMessage in Acquia Connector 8

Same name and namespace in other branches
  1. 8.2 src/ConnectorException.php \Drupal\acquia_connector\ConnectorException::getCustomMessage()
  2. 3.x src/ConnectorException.php \Drupal\acquia_connector\ConnectorException::getCustomMessage()

Get custom message.

Parameters

string $key: Custom message key.

bool $fallback: Default is TRUE. Return standard code or message.

Return value

mixed Custom message of FALSE.

File

src/ConnectorException.php, line 70

Class

ConnectorException
Produce an exception for certain cases in the connector.

Namespace

Drupal\acquia_connector

Code

public function getCustomMessage($key = 'message', $fallback = TRUE) {
  if (isset($this->custom[$key])) {
    return $this->custom[$key];
  }
  if (!$fallback) {
    return FALSE;
  }
  switch ($key) {
    case 'code':
      return $this
        ->getCode();
    case 'message':
      return $this
        ->getMessage();
  }
  return FALSE;
}