25 lines
		
	
	
		
			475 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			475 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| up:: [[cours programmation web serveur]]
 | |
| #s/fac #s/informatique/langage/javascript
 | |
| 
 | |
| 
 | |
| # gestion des erreurs
 | |
| ```js
 | |
| function ExceptionUtilisateur(message) {
 | |
|     this.message = message;
 | |
|     this.name = "Exceptionutilisateur"
 | |
| }
 | |
| 
 | |
| ExceptionUtilisateur.prototype.toString = function() {
 | |
|     return this.name + ': "' + this.message + '"';
 | |
| }
 | |
| 
 | |
| throw new ExceptionUtilisateur("La valeur fournie est trop élevée.");
 | |
| ```
 | |
| 
 | |
| ```js
 | |
| try {
 | |
| } catch(e) {
 | |
|     gererException(e);
 | |
| } finally {
 | |
| }
 | |
| ``` |