ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
GracefullTerminationException.php
Go to the documentation of this file.
1<?php
2
44extends RuntimeException
45implements CAS_Exception
46{
47
60 public function __construct ($message = 'Terminate Gracefully', $code = 0)
61 {
62 // Exit cleanly to avoid filling up the logs with uncaught exceptions.
63 if (self::$_exitWhenThrown) {
64 exit;
65 } else {
66 // Throw exceptions to allow unit testing to continue;
67 parent::__construct($message, $code);
68 }
69 }
70
71 private static $_exitWhenThrown = true;
80 public static function throwInsteadOfExiting()
81 {
82 self::$_exitWhenThrown = false;
83 }
84
85}
86?>
An exception for terminatinating execution or to throw for unit testing.
static throwInsteadOfExiting()
Force phpcas to thow Exceptions instead of calling exit() Needed for unit testing.
__construct($message='Terminate Gracefully', $code=0)
Test if exceptions should be thrown or if we should just exit.
$code
Definition: example_050.php:99
A root exception interface for all exceptions in phpCAS.
Definition: Exception.php:56
catch(Exception $e) $message