Bonjour à tous,
Voilà, j'ai lu le tuto suivant: http://guillaume-affringue.developpe...?page=sommaire
Mais j'ai un peu modifier ma class MyPHPException.
Lorsque je l'utilise sur une fonction de php, tout fonctionne correctement.
L'exception fonctionne.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 <?php require_once('erreur.class.php5'); try { mysql('serveurBidon', 'LoginBidon', 'MDPBidon'); } catch (MyPHPException $myPHPException) { echo $myPHPException->showError(); } ?>
Si maintenant je fait:
J'ai le message d'erreur suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 <?php require_once('erreur.class.php5'); function test($param1){ if ($param1 != 2){ throw new Exception('test'); } else { return print('C\'est 2!'); } } try { test(1); } catch (MyPHPException $myPHPException) { echo $myPHPException->showError(); } ?>
Pouvez vous m'aidez?Fatal error: Uncaught exception 'Exception' with message 'test' in /home.10/mendrock/www/new/class/class/erreur.php5:5 Stack trace: #0 /home.10/mendrock/www/new/class/class/erreur.php5(13): test(3) #1 {main} thrown in /home.10/mendrock/www/new/class/class/erreur.php5 on line 5
Avez-vous besoin de la classe "myPHPException" ?
Merci d'avance.
Partager