Error.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * DataObjects error handler, loaded on demand...
  4. *
  5. * DB_DataObject_Error is a quick wrapper around pear error, so you can distinguish the
  6. * error code source.
  7. *
  8. * PHP versions 4 and 5
  9. *
  10. * LICENSE: This source file is subject to version 3.01 of the PHP license
  11. * that is available through the world-wide-web at the following URI:
  12. * http://www.php.net/license/3_01.txt. If you did not receive a copy of
  13. * the PHP License and are unable to obtain it through the web, please
  14. * send a note to license@php.net so we can mail you a copy immediately.
  15. *
  16. * @category Database
  17. * @package DB_DataObject
  18. * @author Alan Knowles <alan@akbkhome.com>
  19. * @copyright 1997-2006 The PHP Group
  20. * @license http://www.php.net/license/3_01.txt PHP License 3.01
  21. * @version CVS: $Id: Error.php 287158 2009-08-12 13:58:31Z alan_k $
  22. * @link http://pear.php.net/package/DB_DataObject
  23. */
  24. class DB_DataObject_Error extends PEAR_Error
  25. {
  26. /**
  27. * DB_DataObject_Error constructor.
  28. *
  29. * @param string $message
  30. * @param mixed $code DB error code, or string with error message.
  31. * @param integer $mode what "error mode" to operate in
  32. * @param integer $level what error level to use for $mode & PEAR_ERROR_TRIGGER
  33. * @access public
  34. *
  35. * @see PEAR_Error
  36. */
  37. public function __construct(
  38. $message = '',
  39. $code = DB_ERROR,
  40. $mode = PEAR_ERROR_RETURN,
  41. $level = E_USER_NOTICE
  42. )
  43. {
  44. $this->PEAR_Error('DB_DataObject Error: ' . $message, $code, $mode, $level);
  45. }
  46. // todo : - support code -> message handling, and translated error messages...
  47. }