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

Commit

Permalink
Merge pull request #2 from Getsidecar/warning
Browse files Browse the repository at this point in the history
Adds a warning exception class and looks for the warning prefix
  • Loading branch information
robottokauf3 authored Sep 11, 2017
2 parents 7775117 + dbe874c commit 8090fa6
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 8090fa6

Please sign in to comment.