Esempio n. 1
0
 public function __construct($phrase_id = '', $args = array(), $message = '', $code = false, $file = false, $line = false)
 {
     $fullmessage = '<b>API Error</b><br>';
     if ($message) {
         $fullmessage .= '<b>Message:</b>: ' . htmlspecialchars($message) . '<br>';
     }
     if (!empty($line)) {
         $fullmessage .= '<b>Line:</b> ' . htmlspecialchars($line) . '<br>';
     }
     if ($phrase_id) {
         //handle the case where the error is passed in as an array of phrase + params
         if (is_array($phrase_id)) {
             $temp = array_shift($phrase_id);
             if (!$args) {
                 $args = $phrase_id;
             }
             $phrase_id = $temp;
         }
         if (!is_array($args)) {
             $args = array($args);
         }
         $this->add_error($phrase_id, $args);
         $fullmessage .= '<b>Error:</b> ' . htmlspecialchars($phrase_id) . '<br>';
         if ($args) {
             $fullmessage .= '<b>Args:</b><br><pre style="font-family:Lucida Console,Monaco5,monospace;font-size:small;overflow:auto;border:1px solid #CCC;">';
             $fullmessage .= htmlspecialchars(var_export($args, true));
             $fullmessage .= '</pre>';
         }
     }
     parent::__construct($fullmessage, $code, $file, $line);
 }
Esempio n. 2
0
 public function __construct($message, $code = false, $file = false, $line = false)
 {
     $message = $message ? $message : 'Parser Error';
     if (!empty($line)) {
         $message .= "::{$line}";
     }
     parent::__construct($message, $code, $file, $line);
 }
Esempio n. 3
0
 /**
  * Creates a reroute exception with the given route to reroute the controller
  * delegation.
  *
  * @param string $route_path				- The new route path
  * @param string $message					- A user friendly error
  * @param int $code							- The PHP code of the error
  * @param string $file						- The file the exception was thrown from
  * @param int $line							- The line the exception was thrown from
  */
 public function __construct($route_path, $message = false, $code = false, $file = false, $line = false)
 {
     // Store route
     $this->route_path = $route_path;
     // Set default message
     $message = $message ? $message : '';
     // Standard exception initialisation
     parent::__construct($message, $code, $file, $line);
 }
Esempio n. 4
0
	/**
	 * Creates a 404 exception with the given message
	 *
	 * @param string $message					- A user friendly error
	 * @param int $code							- The PHP code of the error
	 * @param string $file						- The file the exception was thrown from
	 * @param int $line							- The line the exception was thrown from
	 */
	public function __construct($message = false, $code = false, $file = false, $line = false)
	{
		if (!$message)
		{
			$message = new vB_Phrase('error', 'invalid_widget_request');
		}
		// Standard exception initialisation
		parent::__construct($message, $code, $file, $line);
	}
Esempio n. 5
0
 /** Standard vB exception constructor for database exceptions.
  *
  *	@param	string	text message
  * 	@param	mixed	array of data- intended for debug mode
  * 	@code	mixed	normally an error flog.  If passed FALSE we won't send an email.
  */
 public function __construct($message = "", $data = array(), $code = 0)
 {
     $this->sql = $message;
     $this->data = $data;
     $message = $this->createMessage();
     $config = vB::getConfig();
     parent::__construct($message, $code);
     if (!empty($config['Database']['technicalemail']) and $code !== FALSE) {
         // This text is purposely hard-coded since we don't have
         // access to the database to get a phrase
         vB_Mail::vbmail($config['Database']['technicalemail'], 'Database Error', $message, true, $config['Database']['technicalemail'], '', '', true);
     }
 }
 public function __construct($params, $code = false, $file = false, $line = false)
 {
     $this->params = $params;
     if (!is_array($this->params)) {
         $this->params = array($this->params);
     }
     //I can't override getMessage because its final. I don't want to fetch the
     //message prematurely because we might not use it directly.  I don't think vBPhrase
     //accepts parameters as an array and even so the exception may do a string cast
     //on the message which won't defer the lookup anyway. Given that this exception is
     //intended to be caught and dealt with it doesn't bear the level of thought
     //required to fix it.
     parent::__construct("internal error", $code, $file, $line);
 }
Esempio n. 7
0
 /**
  * Creates a 404 exception with the given message
  *
  * @param string $message					- A user friendly error
  * @param int $code							- The PHP code of the error
  * @param string $file						- The file the exception was thrown from
  * @param int $line							- The line the exception was thrown from
  */
 public function __construct($message = false, $code = false, $file = false, $line = false)
 {
     $message = $message ? $message : new vB_Phrase('error', 'page_not_found');
     // Standard exception initialisation
     parent::__construct($message, $code, $file, $line);
 }