public function throwExceptionIfFailed() { if ($this->error) { if ($this->exception) { throw $this->exception; } throw new ResultException($this->message); } }