Skip to content
This repository was archived by the owner on Mar 16, 2021. It is now read-only.

Commit

Permalink
Adds a warning exception class and looks for the warning prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Cannon committed Aug 30, 2017
1 parent 7775117 commit dbe874c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,11 @@ public function evalString($string, $parser = self::PARSER_NATIVE) {
if( !$r['is_error'] ) {
return $this->parseResponse($r['contents'], $parser);
}

if(strpos($r['contents'], "R warning:") == 0) {
throw new Rserve_Warning($r);
}

throw new Rserve_Exception('unable to evaluate', $r);
}

Expand Down Expand Up @@ -578,5 +583,8 @@ public function __construct($message, $packet=NULL) {
class Rserve_Parser_Exception extends Rserve_Exception {
}

class Rserve_Warning extends Rserve_Exception {
}

Rserve_Connection::init();

0 comments on commit dbe874c

Please sign in to comment.