]> git.mxchange.org Git - hub.git/blobdiff - application/hub/exceptions.php
Added missing method doShutdown().
[hub.git] / application / hub / exceptions.php
index dbce802e7e1e55f0257982e0b010006d50819063..d5339b1a686f87595a0a9a620d5c850a0a786a32 100644 (file)
@@ -2,9 +2,9 @@
 /**
  * An include file for setting up the exception handler of the hub
  *
- * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0
- * @copyright  Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
+ * @copyright  Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
  * @license            GNU GPL 3.0 or any newer version
  *
  * This program is free software: you can redistribute it and/or modify
@@ -84,17 +84,19 @@ Backtrace:
                // Output the message
                print($message);
        } else {
-               // Invalid exception instance detected! Do *only* throw exceptions that
-               // extends our own exception 'FrameworkException' to get such nice
-               // outputs like above.
-               print("exceptionInstance is invalid! Please inform the core developer team.\n");
+               /*
+                * Invalid exception instance detected! Do *only* throw exceptions that
+                * extends our own exception 'FrameworkException' to get such nice
+                * outputs like above.
+                */
+               print('exceptionInstance[]=' . gettype($exceptionInstance) . ' is invalid! Please inform the core developer team.');
        }
 }
 
 // Error handler
 function __errorHandler ($errno, $errstr, $errfile, $errline, array $errcontext) {
        // Construct the message
-       $message = sprintf("File: %s, Line: %s, Code: %s, Message: %s",
+       $message = sprintf('File: %s, Line: %s, Code: %s, Message: %s',
                basename($errfile),
                $errline,
                $errno,
@@ -113,12 +115,16 @@ function __assertHandler ($file, $line, $code) {
        } // END - if
 
        // Create message
-       $message = sprintf("File: %s, Line: %s, Code: %s",
+       $message = sprintf('File: %s, Line: %s, Code: %s',
                basename($file),
                $line,
                $code
        );
 
+       // Log assert
+       die($message . PHP_EOL);
+       syslog(LOG_WARNING, $message);
+
        // Throw an exception here
        throw new AssertionException($message, BaseFrameworkSystem::EXCEPTION_ASSERTION_FAILED);
 } // END - function
@@ -126,15 +132,17 @@ function __assertHandler ($file, $line, $code) {
 // Set error handler
 //set_error_handler('__errorHandler');
 
-// Set the new handler
+// Set the exception handler
 set_exception_handler('hub_exception_handler');
 
 // Init assert handling
-assert_options(ASSERT_ACTIVE,     true);
-assert_options(ASSERT_WARNING,    false);
-assert_options(ASSERT_BAIL,       false);
-assert_options(ASSERT_QUIET_EVAL, false);
-assert_options(ASSERT_CALLBACK,   '__assertHandler');
+assert_options(ASSERT_ACTIVE    , TRUE);
+assert_options(ASSERT_WARNING   , FALSE);
+assert_options(ASSERT_BAIL      , TRUE);
+assert_options(ASSERT_QUIET_EVAL, FALSE);
+
+// Set assertion handler
+assert_options(ASSERT_CALLBACK  , '__assertHandler');
 
 // [EOF]
 ?>