protected function checkHandler($handler)
{
if (!$handler instanceof ErrorHandlerInterface && !is_callable($handler) && !is_string($handler)) {
$type = is_object($handler) ? get_class($handler) : gettype($handler);
throw new \InvalidArgumentException("Error handler must be callable, string or instance of Autarky\\Errors\\ErrorHandlerInterface, {$type} given");
}
}