Exemplo n.º 1
0
 /**
  * DBException constructor.
  * @param string        $exceptionMessage
  * @param int           $exceptionCode
  * @param string        $dbMessage
  * @param int           $dbCode
  */
 public function __construct($exceptionMessage, $exceptionCode, $dbMessage = null, $dbCode = null)
 {
     if (App::getEnvironment() == 1) {
         parent::__construct($dbMessage, $exceptionCode);
     } else {
         parent::__construct($exceptionMessage, $exceptionCode);
     }
     $this->dbErrorCode = $dbCode;
     $this->dbErrorMessage = $dbMessage;
 }
Exemplo n.º 2
0
Arquivo: Func.php Projeto: xdire/dude
function __sdn()
{
    $isBuffered = \Xdire\Dude\Core\App::getOutputType();
    if ($error = error_get_last()) {
        if ($isBuffered == 1) {
            ob_clean();
        }
        header("HTTP/1.0 500");
        if (\Xdire\Dude\Core\App::getEnvironment() == 1) {
            echo "Error produced by application: \n";
            echo "Code: " . $error['type'] . " \nMessage: " . $error['message'] . " \nFile: " . $error['file'] . " \nLine: " . $error['line'];
        } else {
            $file = explode("/", $error['file']);
            $fileName = strstr(array_pop($file), '.', true);
            echo '{"errorCode":500,"errorMessage":"Error happened, be calm, send us a report and we\'ll fix it. (' . $fileName . ':' . $error['line'] . ') "}';
        }
        if ($isBuffered == 1) {
            ob_flush();
        }
    }
    if ($isBuffered == 1) {
        ob_end_clean();
    }
}