com\setasign\SetaFramework\Bootstrap

ErrorHandler Describes a logger-aware instance.

File: /SetaFramework/src/Bootstrap/ErrorHandler.php

Class hierarchy

Implements

  • \Psr\Log\LoggerAwareInterface

Summary

Constants

ERROR

public const ErrorHandler::ERROR = 4421

EVENT_ON_CATCHED_ERROR

public const ErrorHandler::EVENT_ON_CATCHED_ERROR = 'errorhandler.on-catched-error'

Will be called on catching an error

extraParams:
'error' => Throwable
'level' => string

NOTICE

public const ErrorHandler::NOTICE = 25608

USER_LEVEL

public const ErrorHandler::USER_LEVEL = 18176

WARNING

public const ErrorHandler::WARNING = 690

Properties

$catchedErrors

All not script halting errors will be collected to be shown at the end.

$isDebug

private bool ErrorHandler::$isDebug

$logger

private ?\Psr\Log\LoggerInterface ErrorHandler::$logger

$phpErrorLogger

private ?\Psr\Log\LoggerInterface ErrorHandler::$phpErrorLogger

Methods

__construct()

ErrorHandler constructor.

Parameters
$eventManager : \com\setasign\SetaFramework\EventManager\EventManager
 
$isDebug : bool
 

__wakeup()

public ErrorHandler::__wakeup (
void
): void

addCatchedError()

public ErrorHandler::addCatchedError (
\Throwable $error,
string $level = \Psr\Log\LogLevel::ERROR
): void
Parameters
$error : \Throwable
 
$level : string
 

clearCatchedErrors()

public ErrorHandler::clearCatchedErrors (
void
): void

getCatchedErrors()

public ErrorHandler::getCatchedErrors (
void
): array

handleError()

public ErrorHandler::handleError (
int $severity,
string $errstr,
string $errfile,
int $errline
): bool
Parameters
$severity : int
 
$errstr : string
 
$errfile : string
 
$errline : int
 
Exceptions

Throws \ErrorException

setLogger()

public ErrorHandler::setLogger (
\Psr\Log\LoggerInterface $logger
): void
Parameters
$logger : \Psr\Log\LoggerInterface
 

setPhpErrorLogger()

public ErrorHandler::setPhpErrorLogger (
\Psr\Log\LoggerInterface $logger
): void

Sets a logger instance on the object for php errors.

Parameters
$logger : \Psr\Log\LoggerInterface
 

setupErrorHandling()

protected ErrorHandler::setupErrorHandling (
void
): void