[CLEANUP] Error handling classes
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Error / ErrorHandlerInterface.php
1 <?php
2 namespace TYPO3\CMS\Core\Error;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2009-2013 Ingo Renner <ingo@typo3.org>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26 /**
27 * Error handler interface for TYPO3
28 *
29 * This file is a backport from FLOW3
30 *
31 * @author Ingo Renner <ingo@typo3.org>
32 */
33 interface ErrorHandlerInterface {
34 /**
35 * Registers this class as default error handler
36 *
37 * @param int $errorHandlerErrors The integer representing the E_* error level which should be
38 */
39 public function __construct($errorHandlerErrors);
40
41 /**
42 * Defines which error levels should result in an exception thrown.
43 *
44 * @param int $exceptionalErrors The integer representing the E_* error level to handle as exceptions
45 * @return void
46 */
47 public function setExceptionalErrors($exceptionalErrors);
48
49 /**
50 * Handles an error.
51 * If the error is registered as exceptionalError it will by converted into an exception, to be handled
52 * by the configured exceptionhandler. Additionall the error message is written to the configured logs.
53 * If TYPO3_MODE is 'BE' the error message is also added to the flashMessageQueue, in FE the error message
54 * is displayed in the admin panel (as TsLog message)
55 *
56 * @param int $errorLevel The error level - one of the E_* constants
57 * @param string $errorMessage The error message
58 * @param string $errorFile Name of the file the error occurred in
59 * @param int $errorLine Line number where the error occurred
60 * @return bool
61 * @throws \TYPO3\CMS\Core\Error\Exception with the data passed to this method if the error is registered as exceptionalError
62 */
63 public function handleError($errorLevel, $errorMessage, $errorFile, $errorLine);
64
65 }