sureshchahal / angular2-adal

Angular 2 wrapper for adal.js
MIT License
41 stars 50 forks source link

this was undefined in getUser error handler #80

Closed wvanderdeijl closed 2 years ago

wvanderdeijl commented 6 years ago

you get here when calling getUser() before logging in. The adal library then throws 'User information is not available' string.

One could argue that ng2-adal should even catch the 'User information is not available' and emit undefined from the Observable. Once the user logs in the Observable will emit the User object. To me that feels more how an Observable should work. But for now, I just fixed the error handling code so the 'User information is not available' string is at least re-thrown so I can catch that in my own Observable (and emit undefined). With the current implementation the ng2-adal library throws a TypeError as this.adalContext is undefined in the error handler