4 * This file is part of Psy Shell.
6 * (c) 2012-2017 Justin Hileman
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Psy\Exception;
15 * A break exception, used for halting the Psy Shell.
17 class BreakException extends \Exception implements Exception
24 public function __construct($message = '', $code = 0, \Exception $previous = null)
26 $this->rawMessage = $message;
27 parent::__construct(sprintf('Exit: %s', $message), $code, $previous);
31 * Return a raw (unformatted) version of the error message.
35 public function getRawMessage()
37 return $this->rawMessage;
41 * Throws BreakException.
43 * Since `throw` can not be inserted into arbitrary expressions, it wraps with function call.
45 * @throws BreakException
47 public static function exitShell()
49 throw new self('Goodbye');