Skip to content

Commit

Permalink
Added printing exceptions logs.| #716
Browse files Browse the repository at this point in the history
  • Loading branch information
DenBond7 committed Aug 25, 2020
1 parent 83c1126 commit b4d3649
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ class OAuth2AuthCredentialsViewModel(application: Application) : BaseAndroidView
}
authorizationRequestLiveData.postValue(Result.success(authRequest))
} catch (e: IOException) {
e.printStackTrace()
authorizationRequestLiveData.postValue(Result.exception(AuthorizationException.fromTemplate(AuthorizationException.GeneralErrors.NETWORK_ERROR, e)))
} catch (e: JSONException) {
e.printStackTrace()
authorizationRequestLiveData.postValue(Result.exception(AuthorizationException.fromTemplate(
AuthorizationException.GeneralErrors.JSON_DESERIALIZATION_ERROR, e)))
} catch (e: AuthorizationServiceDiscovery.MissingArgumentException) {
e.printStackTrace()
authorizationRequestLiveData.postValue(Result.exception(AuthorizationException.fromTemplate(
AuthorizationException.GeneralErrors.INVALID_DISCOVERY_DOCUMENT, e)))
} catch (e: Exception) {
e.printStackTrace()
authorizationRequestLiveData.postValue(Result.exception(e))
}
}
Expand Down Expand Up @@ -132,6 +136,7 @@ class OAuth2AuthCredentialsViewModel(application: Application) : BaseAndroidView

microsoftOAuth2TokenLiveData.postValue(Result.success(recommendAuthCredentials))
} catch (e: Exception) {
//we don't store stacktrace to prevent tokens leaks
if (e is InvalidJwtException) {
microsoftOAuth2TokenLiveData.postValue(Result.exception(InvalidJwtException("JWT validation was failed!\n\n", e.errorDetails, e.jwtContext)))
} else {
Expand Down

0 comments on commit b4d3649

Please sign in to comment.