Closed Deklin closed 5 years ago
Would it be possible to know what are you specifically looking for?
When there is an error with the locale loading, there is a broadcast of type $localeChangeError would this be enough for the issue you are facing?
On Fri, Oct 6, 2017 at 12:01 AM Steve Berube notifications@github.com wrote:
So if karma can't load the required file, we are getting an error
the string "Possibly unhandled rejection: en-us" was thrown, throw an Error :)
Is there a way to define the rejection handler in the config phase for the dynamic locale?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lgalfaso/angular-dynamic-locale/issues/117, or mute the thread https://github.com/notifications/unsubscribe-auth/AAX44tPCfU1hNa1zRlMFEM6z1FziKMSWks5spVGfgaJpZM4Pvwow .
We are trying to figure out how to get by this.
What would be helpful is in the config phase to set a rejection method so we can log or toss the rejection. Because its unhandled when we do our unit tests right now, this is failing because of the unhandled rejection
something like;
tmhDynamicLocaleProvider.onLocaleLoadFailure(function(e) { // Toss the error. };
I'm assuming somewhere there is a promise that is rejecting based on not loading the requested locale file, if we can swallow that or at least have a way to process it, that should solve it.
I am also reviewing the code now to see if I can explain better or find the actual problem.
tmhDynamicLocale.set returns a promise that is rejected when loading the locale fails.
On Fri, Oct 6, 2017 at 11:03 PM Steve Berube notifications@github.com wrote:
I am also reviewing the code now to see if I can explain better or find the actual problem.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/lgalfaso/angular-dynamic-locale/issues/117#issuecomment-334869505, or mute the thread https://github.com/notifications/unsubscribe-auth/AAX44io88Xx4W378E033rB8zfeDVU2Pgks5sppWPgaJpZM4Pvwow .
From the last comment, my understanding is that this issue is resolved.
In case anyone else in the future needs a code example of the solution here, when setting the locale, define a catch with an empty function:
tmhDynamicLocale.set('en-US').catch(() => {});
So if karma can't load the required file, we are getting an error
Is there a way to define the rejection handler in the config phase for the dynamic locale?