public class GenericExceptionHandler

class.errorhandler.php #13

GenericExceptionHandler will handle any uncaught exceptions thrown in Symphony. Additionally, all errors in Symphony that are raised to Exceptions will be handled by this class. It is possible for Exceptions to be caught by their own ExceptionHandler which can override the render function so that it can be displayed to the user appropriately.

Properties

static boolean $enabled

Whether the GenericExceptionHandler should handle exceptions. Defaults to true

Methods

static mixed getTemplate(string $name)

Returns the path to the error-template by looking at the WORKSPACE/template/ directory, then at the TEMPLATES directory for the convention *.tpl. If the template is not found, false is returned

Parameters
  • $name stringName of the template

Returns

String, which is the path to the template if the template is found, false otherwise

static string handler(Exception $e)

The handler function is given an Exception and will call it's render function to display the Exception to a user. After calling the render function, the output is displayed and then exited to prevent any further logic from occurring.

Parameters
  • $e ExceptionThe Exception object

Returns

The result of the Exception's render function

static void initialise(Log $Log)

Initialise will set the error handler to be the __CLASS__::handler function.

Parameters
  • $Log LogAn instance of a Symphony Log object to write errors to

static string render(Exception $e)

The render function will take an Exception and output a HTML page

Parameters
  • $e ExceptionThe Exception object

Returns

An HTML string

static string renderHtml(string $template, string $heading, string $message, string $file, string $line, string $lines, string $trace, string $queries)

This function will fetch the desired $template, and output the Exception in a user friendly way.

Parameters
  • $template stringThe template name, which should correspond to something in the TEMPLATE directory, eg fatalerror.fatal.

Returns

The HTML of the formatted error message.

static void shutdown()

The shutdown function will capture any fatal errors and format them as a usual Symphony page.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details