예제 #1
0
 /**
  * Force the error display and log it
  * @return void
  */
 public function render()
 {
     $exception_context = array('type' => get_called_class(), 'code' => $this->getCode(), 'message' => $this->getMessage(), 'line' => $this->getLine(), 'file' => $this->getFile());
     $this->webservices->log($this->webservices->getOption('error_log_mask'), $exception_context, Logger::ERROR);
     $this->webservices->getResponse()->addContent('error', $exception_context);
     $this->webservices->display();
 }
 /**
  * Force the error display and log it
  *
  * @return void
  */
 public function render()
 {
     $exception_context = array('type' => get_called_class(), 'code' => $this->getCode() . ' [severity: ' . $this->getSeverity() . ']', 'message' => $this->getMessage(), 'line' => $this->getLine(), 'file' => $this->getFile());
     $this->webservices->log($this->webservices->getOption('error_log_mask'), $exception_context, Logger::CRITICAL);
     $this->webservices->log($this->getTraceAsString(), array(), Logger::CRITICAL);
     $this->webservices->getResponse()->addContent('error', $exception_context);
     $this->webservices->display();
 }
예제 #3
0
/**
 * Show errors at least initially
 *
 * `E_ALL` => for hard dev
 * `E_ALL & ~E_STRICT` => for hard dev in PHP5.4 avoiding strict warnings
 * `E_ALL & ~E_NOTICE & ~E_STRICT` => classic setting
 */
//@ini_set('display_errors','1'); @error_reporting(E_ALL);
//@ini_set('display_errors','1'); @error_reporting(E_ALL & ~E_STRICT);
@ini_set('display_errors', '1');
@error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
/**
 * Set a default timezone to avoid PHP5 warnings
 */
$dtmz = @date_default_timezone_get();
date_default_timezone_set($dtmz ?: 'Europe/Paris');
// get the Composer autoloader
if (file_exists($a = __DIR__ . '/../../../autoload.php')) {
    require_once $a;
} elseif (file_exists($b = __DIR__ . '/../vendor/autoload.php')) {
    require_once $b;
    // else error, classes can't be found
} else {
    die(json_encode("You need to run Composer on the project to build dependencies and auto-loading" . " (see: http://getcomposer.org/doc/00-intro.md#using-composer)!"));
}
// user options
$options = array('tmp_directory' => __DIR__ . '/tmp', 'var_directory' => __DIR__ . '/../var', 'log_directory' => __DIR__ . '/../var/logs', 'enable_logging' => true, 'enable_url_rewrite' => true, 'controllers_mapping' => array());
// distribute request
\WebServices\FrontController::create(new \Library\HttpFundamental\Request(), new \Library\HttpFundamental\Response(), $options)->distribute();
// or exit
exit(json_encode('ERROR IN RENDERING !'));
예제 #4
0
 /**
  * @param string $message
  * @param int $code
  * @param \Exception $previous
  */
 public function __construct($message = '', $code = 0, \Exception $previous = null)
 {
     parent::__construct($message, $code, $previous);
     $this->setFrontController(FrontController::getInstance());
     $this->webservices->setStatus(FrontController::STATUS_TREATMENT_ERROR)->getResponse()->setStatus(HttpStatus::ERROR);
 }
 /**
  * @param string $message
  * @param int $code
  * @param int $severity
  * @param string $filename
  * @param int $lineno
  * @param \Exception $previous
  */
 public function __construct($message = '', $code = 0, $severity = 1, $filename = __FILE__, $lineno = __LINE__, \Exception $previous = null)
 {
     parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
     $this->setFrontController(FrontController::getInstance());
     $this->webservices->setStatus(FrontController::STATUS_INTERNAL_ERROR)->getResponse()->setStatus(HttpStatus::ERROR);
 }