Wrap model phonenumber validation in try/catch
This commit is contained in:
		
					parent
					
						
							
								eae072e72d
							
						
					
				
			
			
				commit
				
					
						c84ccfc735
					
				
			
		
					 1 changed files with 11 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -47,6 +47,7 @@
 | 
			
		|||
 | 
			
		||||
        // hack
 | 
			
		||||
        if (this.get('type') === 'private') {
 | 
			
		||||
            try {
 | 
			
		||||
                this.id = libphonenumber.util.verifyNumber(this.id);
 | 
			
		||||
                var number = libphonenumber.util.splitCountryCode(this.id);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +56,9 @@
 | 
			
		|||
                    national_number: '' + number.national_number,
 | 
			
		||||
                    international_number: '' + number.country_code + number.national_number
 | 
			
		||||
                });
 | 
			
		||||
 | 
			
		||||
            } catch(ex) {
 | 
			
		||||
                return ex;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue