Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 17244 программиста и 1834 робота. Сейчас ищут 1692 программиста ...

Introduction

Вернуться к: Gtk2_ExceptionDump

Introduction

Introduction – Using Gtk2_ExceptionDump

Gtk2_ExceptionDump catches and displays common errors and warnings that can be produced in a PHP scripts: PHP errors, notices and warnings as well as PEAR Errors and uncaught exceptions. They are displayed in a Gtk2 window with a tree view, providing the error message and the backtrace with passed parameters.

The most easy thing to do is letting the class handle everything automatically. You can decide which errors should be catched: All, PHP errors, PEAR errors or uncaught exceptions. The following methods need to be called statically to set up error handling:

  • setupExceptionHandler()

  • setupPearErrorHandler()

  • setupPhpErrorHandler()

  • setupAllHandlers()

Letting Gtk2_ExceptionDump handle all errors

<?php
require_once 'Gtk2/ExceptionDump.php';
Gtk2_ExceptionDump::setupAllHandlers();
?>

Handling exceptions by hand

If you don't want to let Gtk2_ExceptionDump handle errors automatically, you can display the window by hand, e.g. in a catch() statement.

Catching exceptions by hand

<?php
try {
    
//do some stuff that
    //could throw an exception
} catch (Exception $e) {
    require_once 
'Gtk2/ExceptionDump.php';
    
Gtk2_ExceptionDump::display($e);
}
?>

More examples

As usually, the package has more examples in the doc directory: /path/to/pear/docs/Gtk2_ExceptionDump/examples/.



Вернуться к: Gtk2_ExceptionDump

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware