Basic

Overview

This example will show you how HTML_Progress2 handle errors (and especially exception) with default error handler (standard PEAR_Error object).

By default all exceptions halt the script, so line 20 will never be reached !

Screenshot

Exception: invalid input, parameter #3 "$min" was expecting "integer", instead got "string" in html_progress2->html_progress2 (file [path_to]\errorbasic.php on line 18)

Demonstration

warning For security reasons live demo is not available and i've replaced the real path to file errorbasic.php by [path_to]. But in real conditions, you will see it!

Dependencies

This example requires mandatory resources :

Source Code

  1. <?php
  2. /**
  3. * Basic error renderer with default PEAR_Error object.
  4. *
  5. * @version    $Id: errorbasic.php,v 1.1 2005/06/12 21:03:04 farell Exp $
  6. * @author     Laurent Laville <pear@laurent-laville.org>
  7. * @package    HTML_Progress2
  8. * @subpackage Examples
  9. * @access     public
  10. */
  11.  
  12. require_once 'HTML/Progress2.php';
  13. require_once 'PEAR.php';
  14.  
  15. // Example A. ---------------------------------------------
  16.  
  17. // A1. Exception
  18. $pb1 = new HTML_Progress2(null, HTML_PROGRESS2_BAR_VERTICAL, '0', 130);
  19.  
  20. print 'still alive !';
  21.  
  22. ?>