Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. ------------------
  2. DBWrapper class
  3. ------------------
  4. 1. readData appel readDataEXE() et attrape DBWrapperStatementException
  5. readData() {
  6. try {
  7. ...
  8. readDataEXE() et attrape ();
  9. ...
  10. } catch (DBWrapperStatementException $ex){
  11. // ICI, L'EXCEPTION N'EST PAS ATTRAPÉ !!!
  12. echo "readData(): Caught DBWrapperStatementException!"
  13. throw $ex;
  14. }
  15. }
  16.  
  17. 2. readDataEXE constuit un objet DBWrapperStatement et attrape DBWrapperStatementException
  18. readDataEXE() {
  19. try {
  20. ...
  21. $stmt = new DBWrapperStatement();
  22. ...
  23. } catch (DBWrapperStatementException $ex){
  24. echo "readDataEXE(): Caught DBWrapperStatementException!"
  25. throw $ex;
  26. }
  27. }
  28.  
  29. 3. Le constructeur du DBWrapperStatement lance une exception DBWrapperStatementException
  30. ------------------
  31. DBWrapperStatement class
  32. ------------------
  33. Constructor {
  34. throw new throw new DBWrapperStatementException("TEST!!!");
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement