ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
GracefullTerminationException.php
Go to the documentation of this file.
1<?php
2
43class CAS_GracefullTerminationException extends RuntimeException implements CAS_Exception
44{
45
58 public function __construct($message = 'Terminate Gracefully', $code = 0)
59 {
60 // Exit cleanly to avoid filling up the logs with uncaught exceptions.
61 if (self::$_exitWhenThrown) {
62 exit;
63 } else {
64 // Throw exceptions to allow unit testing to continue;
65 parent::__construct($message, $code);
66 }
67 }
68
69 private static $_exitWhenThrown = true;
78 public static function throwInsteadOfExiting()
79 {
80 self::$_exitWhenThrown = false;
81 }
82}
exit
Definition: backend.php:16
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