Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> wyjatki, a raczej problem z nimi
deniol13
post
Post #1





Grupa: Zarejestrowani
Postów: 190
Pomógł: 2
Dołączył: 30.11.2009

Ostrzeżenie: (10%)
X----


witam, ostatnio napotkalem sie z wyjatkami (exception, nie wiem czy dobrze przetlumaczylem)
no i mam taka prosta klase do wyjatkow
  1. <?php
  2. /**
  3.  * visionBoard
  4.  *
  5.  * @author Denis Wróbel
  6.  * @package visionBoard
  7.  * @license <a href="http://www.gnu.org/licenses/gpl-3.0.html" target="_blank">http://www.gnu.org/licenses/gpl-3.0.html</a>
  8.  * @version 0.1
  9.  *
  10.  */
  11.  
  12. class visionException extends Exception
  13. {
  14. /**
  15. * Exception type
  16. */
  17.  
  18. private $exc_type = '';
  19.  
  20. /**
  21. * Exception message
  22. */
  23.  
  24. private $exc_message = '';
  25.  
  26. /**
  27. * Exception cause
  28. */
  29.  
  30. private $exc_cause = '';
  31.  
  32. // ------------------------------------------------------------------------
  33.  
  34. /**
  35. * Exception constructor
  36. *
  37. * @param string $ext_type
  38. * @param string $exc_message
  39. */
  40.  
  41. function __construct( $ext_type, $exc_message, $exc_cause)
  42. {
  43.  
  44. // Pass variables from function arguments to in-class variables
  45. $this -> exc_type = $ext_type;
  46. $this -> exc_message = $exc_message;
  47. $this -> exc_cause = $exc_cause;
  48.  
  49. }
  50.  
  51. /**
  52. * Returns exception page HTML
  53. */
  54.  
  55. function __toString()
  56. {
  57. return $this->exc_cause . $this->exc_message . $this->exc_type;
  58. }
  59. }
  60.  
  61. ?>


no i jak cos nie pasuje to robie w klase macierzystej ze tak to nazwe
  1. throw new visionException( 'COS', 'COS2', 'COS3' );


no i efekt
  1. Fatal error: Uncaught COS3COS2COS thrown in E:\htdocs\vision\index.php on line 25


nie umiem sobie z tym poradzic sad.gif pomocy
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 10:36