/**
  * This class implements the Singleton pattern. There is only ever
  * one instance of the this class and it is accessed only via the 
  * ClassName::instance() method.
  * 
  * @return object 
  * @access public
  * @since 5/26/05
  * @static
  */
 public static function instance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new ErrorPrinter();
     }
     return self::$instance;
 }
Exemple #2
0
    print $xmlString;
    if (SHOW_TIMERS_IN_OUTPUT) {
        $end2 = microtime();
        list($sm, $ss) = explode(" ", $start);
        list($em, $es) = explode(" ", $end);
        $s = $ss + $sm;
        $e = $es + $em;
        print "\n<time>" . ($e - $s) . "</time>";
        list($sm, $ss) = explode(" ", $end);
        list($em, $es) = explode(" ", $end2);
        $s = $ss + $sm;
        $e = $es + $em;
        print "\n<output_time>" . ($e - $s) . "</output_time>";
        print "\n<number>" . count($results) . "</number>";
    }
    // Handle certain types of uncaught exceptions specially. In particular,
    // Send back HTTP Headers indicating that an error has ocurred to help prevent
    // crawlers from continuing to pound invalid urls.
} catch (UnknownActionException $e) {
    ErrorPrinter::handleException($e, 404);
} catch (NullArgumentException $e) {
    ErrorPrinter::handleException($e, 400);
} catch (InvalidArgumentException $e) {
    ErrorPrinter::handleException($e, 400);
} catch (PermissionDeniedException $e) {
    ErrorPrinter::handleException($e, 403);
} catch (UnknownIdException $e) {
    ErrorPrinter::handleException($e, 404);
} catch (Exception $e) {
    ErrorPrinter::handleException($e, 500);
}
Exemple #3
0
function handleError($type, $msg, $file, $line, $context)
{
    echo ErrorPrinter::printError($type, $msg, $file, $line, $context);
}