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,15 +47,18 @@
|
|||
|
||||
// hack
|
||||
if (this.get('type') === 'private') {
|
||||
this.id = libphonenumber.util.verifyNumber(this.id);
|
||||
var number = libphonenumber.util.splitCountryCode(this.id);
|
||||
|
||||
this.set({
|
||||
e164_number: this.id,
|
||||
national_number: '' + number.national_number,
|
||||
international_number: '' + number.country_code + number.national_number
|
||||
});
|
||||
try {
|
||||
this.id = libphonenumber.util.verifyNumber(this.id);
|
||||
var number = libphonenumber.util.splitCountryCode(this.id);
|
||||
|
||||
this.set({
|
||||
e164_number: this.id,
|
||||
national_number: '' + number.national_number,
|
||||
international_number: '' + number.country_code + number.national_number
|
||||
});
|
||||
} catch(ex) {
|
||||
return ex;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue