From 13e2c5d25f4dac0e876b51d41b67477d4a30e913 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Wed, 23 Mar 2022 17:11:24 +0100 Subject: [PATCH] Add `onError` action callback (#427) This allows users of the component to handle errors that happen while async loading the `intl-tel-input` library. --- addon/components/phone-input.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addon/components/phone-input.js b/addon/components/phone-input.js index 40393b2b..a35d42ef 100644 --- a/addon/components/phone-input.js +++ b/addon/components/phone-input.js @@ -215,6 +215,10 @@ export default Component.extend({ 'countrychange', this._onCountryChange.bind(this) ); + } catch (error) { + if (this.onError) { + this.onError(error); + } } finally { if (!this.isDestroying && !this.isDestroyed) { this.set('isLoadingIti', false);