| @@ 20-55 (lines=36) @@ | ||
| 17 | /** |
|
| 18 | * Class FormatterException. |
|
| 19 | */ |
|
| 20 | final class FormatterStopException extends RuntimeException |
|
| 21 | { |
|
| 22 | const MESSAGE_STOP_MSG = 'Error attempting to parse stop message for log'; |
|
| 23 | const MESSAGE_PARSE_CODE = 1; |
|
| 24 | ||
| 25 | const LEVEL_STOP_MSG = 'Error determining log level for stop'; |
|
| 26 | const LEVEL_STOP_CODE = 2; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * @param \Exception $e The previous exception |
|
| 30 | * |
|
| 31 | * @return FormatterStopException |
|
| 32 | */ |
|
| 33 | public static function msg(Exception $e) |
|
| 34 | { |
|
| 35 | return new self( |
|
| 36 | self::MESSAGE_STOP_MSG, |
|
| 37 | self::MESSAGE_PARSE_CODE, |
|
| 38 | $e |
|
| 39 | ); |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @param \Exception $e The previous exception |
|
| 44 | * |
|
| 45 | * @return FormatterStopException |
|
| 46 | */ |
|
| 47 | public static function level(Exception $e) |
|
| 48 | { |
|
| 49 | return new self( |
|
| 50 | self::LEVEL_STOP_MSG, |
|
| 51 | self::LEVEL_STOP_CODE, |
|
| 52 | $e |
|
| 53 | ); |
|
| 54 | } |
|
| 55 | } |
|
| 56 | ||
| @@ 20-55 (lines=36) @@ | ||
| 17 | /** |
|
| 18 | * Class TimersException. |
|
| 19 | */ |
|
| 20 | final class TimersException extends RuntimeException |
|
| 21 | { |
|
| 22 | const TIMER_START_MSG = 'An error occurred while attempting to start the timer'; |
|
| 23 | const TIMER_START_CODE = 32; |
|
| 24 | ||
| 25 | const TIMER_STOP_MSG = 'An error occurred while attempting to stop the timer'; |
|
| 26 | const TIMER_STOP_CODE = 64; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * @param \Exception $e The timer exception |
|
| 30 | * |
|
| 31 | * @return TimersException |
|
| 32 | */ |
|
| 33 | public static function start(Exception $e) |
|
| 34 | { |
|
| 35 | return new self( |
|
| 36 | self::TIMER_STOP_MSG, |
|
| 37 | self::TIMER_STOP_CODE, |
|
| 38 | $e |
|
| 39 | ); |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @param \Exception $e The timer exception |
|
| 44 | * |
|
| 45 | * @return TimersException |
|
| 46 | */ |
|
| 47 | public static function stop(Exception $e) |
|
| 48 | { |
|
| 49 | return new self( |
|
| 50 | self::TIMER_STOP_MSG, |
|
| 51 | self::TIMER_STOP_CODE, |
|
| 52 | $e |
|
| 53 | ); |
|
| 54 | } |
|
| 55 | } |
|
| 56 | ||