Guest User

Untitled

a guest
May 24th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. class GPS_Coord extends Exception{}
  2. class OutputCoord extends Exception {}
  3. class ErorrNullable extends Exception{}
  4.  
  5. function drawPoint($point){
  6. if ($point!=0){
  7. if (is_string($point)){
  8. throw new GPS_Coord("Это строка!!", 200);
  9. }
  10. elseif($point > 500 && $point<10){
  11. throw new OutputCoord("point >500 Erorr input user!", 300);
  12. }
  13. else return $point;
  14. }
  15. else throw new ErorrNullable("Nullable number! Error",100);
  16. }
  17. try {
  18. echo drawPoint(3);
  19. }catch(GPS_Coord $e){
  20. echo $e->getMessage();
  21. }catch(OutputCoord $e){
  22. echo $e->getMessage();
  23. }catch(ErorrNullable $e){
  24. echo $e->getMessage();
  25. }
Add Comment
Please, Sign In to add comment