public function __construct($e) { $this->e = $e; if (!$e instanceof BF_user_exception) { // log error and send mail if requiered BF_error::log($e); } // array of infos to display to user try { // if we are dealing with a user error if ($e instanceof BF_user_exception) { $this->display['type'] = get_class($e); $this->display['title'] = BF::gl()->tl($this->e->display['title'] ? $this->e->display['title'] : '[xx:error.title_' . $this->display['type'] . ']'); $this->display['message'] = BF::gl()->tl($this->e->display['message'] ? $this->e->display['message'] : '[xx:error.' . $this->display['type'] . ']'); // otherwise if a php error (bug) } else { $this->display['title'] = BF::gl()->tl_tag("error.title_BF_internal"); $this->display['message'] = BF::gl()->tl_tag("error.BF_internal"); $this->display['type'] = 'BF_internal'; } } catch (exception $new_e) { // if a second exception occurs while translating, then just skip this step $this->display['title'] = 'Error occured'; $this->display['message'] = 'Internal Error'; $this->display['type'] = 'BF_internal'; } }
/** * Framework exception handler * @param exception $e : exception object */ public static function exception_handler($e) { try { try { BF::load_module("BF_error"); } catch (exception $e) { die("FATAL ERROR: Failed loading error repporting module BF_error"); } $error = new BF_error($e); $error->display(BF::$error_output_callback); } catch (exception $new_e) { print 'Fatal Error. Second exception occured while handling exception.'; } }