Error.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 mixed $code DB error code, or string with error message.
  30. * @param integer $mode what "error mode" to operate in
  31. * @param integer $level what error level to use for $mode & PEAR_ERROR_TRIGGER
  32. * @param mixed $debuginfo additional debug info, such as the last query
  33. *
  34. * @access public
  35. *
  36. * @see PEAR_Error
  37. */
  38. function DB_DataObject_Error($message = '', $code = DB_ERROR, $mode = PEAR_ERROR_RETURN,
  39. $level = E_USER_NOTICE)
  40. {
  41. $this->PEAR_Error('DB_DataObject Error: ' . $message, $code, $mode, $level);
  42. }
  43. // todo : - support code -> message handling, and translated error messages...
  44. }