getOrFail() public method

If the key does not exist in the store, an exception is thrown. Any integer or string value is accepted as key. If any other type is passed for the key, an {@link InvalidKeyException} is thrown. You should make sure that you only pass valid keys to the store. If the backend of the store cannot be read, a {@link ReadException} is thrown. You should always handle this exception in your code: php try { $value = $store->getOrFail($key); } catch (ReadException $e) { read failed }
public getOrFail ( integer | string $key ) : mixed
$key integer | string The key to get.
return mixed The value of the key.
 /**
  * {@inheritdoc}
  */
 public function getOrFail($key)
 {
     return $this->store->getOrFail($key);
 }