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
|
// hack
|
||||||
if (this.get('type') === 'private') {
|
if (this.get('type') === 'private') {
|
||||||
this.id = libphonenumber.util.verifyNumber(this.id);
|
try {
|
||||||
var number = libphonenumber.util.splitCountryCode(this.id);
|
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
|
|
||||||
});
|
|
||||||
|
|
||||||
|
this.set({
|
||||||
|
e164_number: this.id,
|
||||||
|
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