/** * Captura a exceção gerada e trata o retorno para JSON * * @param Exception $ex */ public function setException($ex) { $this->_error = true; $this->_data = array(); $this->_data['error'] = true; @($this->_data['exception']['code'] = $ex->getCode()); $this->_data['exception']['message'] = $ex->getMessage(); @($this->_data['exception']['notification'] = $ex->getNotification()); if ($this->_data['exception']['notification'] == '') { $this->_data['exception']['notification'] = 'Error'; } }