error handling
This commit is contained in:
		
							parent
							
								
									a9aa739a3e
								
							
						
					
					
						commit
						90b28c793b
					
				
					 1 changed files with 10 additions and 2 deletions
				
			
		|  | @ -36,7 +36,11 @@ | ||||||
| 			"id": "decodeuri", | 			"id": "decodeuri", | ||||||
| 			"name": "Decode URI", | 			"name": "Decode URI", | ||||||
| 			"convert": function(input) { | 			"convert": function(input) { | ||||||
|  | 				try { | ||||||
| 					return decodeURI(input) | 					return decodeURI(input) | ||||||
|  | 				} catch (exception) { | ||||||
|  | 					return "Invalid URI string."; | ||||||
|  | 				} | ||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
|  | @ -52,7 +56,11 @@ | ||||||
| 			"id": "decodeuricomponent", | 			"id": "decodeuricomponent", | ||||||
| 			"name": "Decode URI component", | 			"name": "Decode URI component", | ||||||
| 			"convert": function(input) { | 			"convert": function(input) { | ||||||
|  | 				try { | ||||||
| 					return decodeURIComponent(input) | 					return decodeURIComponent(input) | ||||||
|  | 				} catch (exception) { | ||||||
|  | 					return "Invalid URI component string."; | ||||||
|  | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	]; | 	]; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue