You are here

class AuthenticationKeyValueMalformedException in Apigee Edge 8

Defines an exception for when a key value is malformed.

Hierarchy

Expanded class hierarchy of AuthenticationKeyValueMalformedException

1 file declares its use of AuthenticationKeyValueMalformedException
EdgeKeyTypeBase.php in src/Plugin/EdgeKeyTypeBase.php

File

src/Exception/AuthenticationKeyValueMalformedException.php, line 8

Namespace

Drupal\apigee_edge\Exception
View source
class AuthenticationKeyValueMalformedException extends AuthenticationKeyException implements ApigeeEdgeExceptionInterface {

  /**
   * The key value field that is malformed.
   *
   * @var string
   */
  protected $problematicField;

  /**
   * KeyValueMalformedException constructor.
   *
   * We do not expose the name of problematic field by default in the message.
   *
   * @param string $problematic_field
   *   Name of the field that caused the issue.
   * @param string $message
   *   Exception message.
   * @param int $code
   *   Error code.
   * @param \Throwable|null $previous
   *   Previous exception.
   */
  public function __construct($problematic_field, $message = 'Apigee Edge API authentication key is malformed or not readable.', $code = 0, \Throwable $previous = NULL) {
    $this->problematicField = $problematic_field;
    $message = strtr($message, [
      '@field' => $problematic_field,
    ]);
    parent::__construct($message, $code, $previous);
  }

  /**
   * Returns the name of the problematic field of a key.
   *
   * @return string
   *   Name of the field.
   */
  public function getProblematicField() : string {
    return $this->problematicField;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AuthenticationKeyValueMalformedException::$problematicField protected property The key value field that is malformed.
AuthenticationKeyValueMalformedException::getProblematicField public function Returns the name of the problematic field of a key.
AuthenticationKeyValueMalformedException::__construct public function KeyValueMalformedException constructor.