final public static function exceptionHandler($exception)
	{
		$response = null;

		if (!$exception instanceof \Exception\BooBoo) {
			$class = get_class($exception);
			$msg = preg_replace("~[\r\n]~", ' ', $exception->getMessage());

			$context = self::getContext(self::EXCEPTION, $class, $msg, $exception->getFile(), $exception->getLine(), $exception->getCode());

			if (!empty(self::$logger)) {
				self::$logger->critical($class.": {$msg} in {$exception->getFile()} in line {$exception->getLine()}.", $context);
			}
			else {
				error_log(self::getExceptionMsg($class, $exception, self::$trace));
			}

			if (!is_null(self::$lastAction)) {
				$fn = self::$lastAction;
				$fn();
			}

			$response = self::$httpHandler->overwrite(
				self::getErrorTemplate(self::$httpHandler, self::$defaultErrorPath)
			);
		}
		else {
			if (self::$booboo->alwaysLog || self::$alwaysLog) {
				$context = self::getContext(self::BOOBOO, self::$booboo->tag, $exception->getMessage(), $exception->getFile(), $exception->getLine());

				$logMsg = self::getExceptionMsg(self::$booboo->tag, $exception, self::$booboo->trace);

				if (self::$booboo->httpHandler->getStatusCode() >= 500) {
					if (!empty(self::$logger)) {
						self::$logger->critical($logMsg, $context);
					}
					else {
						error_log($logMsg);
					}
				}
				else {
					if (!empty(self::$logger)) {
						self::$logger->warning($logMsg, $context);
					}
					else {
						error_log($logMsg);
					}
				}
			}

			if (!is_null(self::$lastAction)) {
				$fn = self::$lastAction;
				$fn();
			}

			/*self::$booboo->httpHandler->overwrite(
				self::getErrorTemplate(
					self::$booboo->httpHandler,
					self::$booboo->templates,
					self::$booboo->displayMessage,
					self::$booboo->templateData
				)
			)->send();*/

			$response = self::$booboo->httpHandler->overwrite(
				self::getErrorTemplate(
					self::$booboo->httpHandler,
					self::$booboo->templates,
					self::$booboo->displayMessage,
					self::$booboo->templateData
				)
			);
		}

		if (self::$exit) {
			$response->send();
		} else {
			return $response;
		}
	}