ServerException.php 586 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /*
  3. * This file is part of the Predis package.
  4. *
  5. * (c) Daniele Alessandri <suppakilla@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Predis;
  11. class ServerException extends PredisException implements IRedisServerError
  12. {
  13. public function getErrorType()
  14. {
  15. list($errorType, ) = explode(' ', $this->getMessage(), 2);
  16. return $errorType;
  17. }
  18. public function toResponseError()
  19. {
  20. return new ResponseError($this->getMessage());
  21. }
  22. }