mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-14 15:17:02 -04:00
Fix[msa]: handle PresentedExceptions without a set cause
This commit is contained in:
parent
1e8e1757ab
commit
af4ae5e919
@ -99,9 +99,15 @@ public class mcAccountSpinner extends AppCompatSpinner implements AdapterView.On
|
||||
|
||||
private final ErrorListener mErrorListener = errorMessage -> {
|
||||
mLoginBarPaint.setColor(Color.RED);
|
||||
Context context = getContext();
|
||||
if(errorMessage instanceof PresentedException) {
|
||||
PresentedException exception = (PresentedException) errorMessage;
|
||||
Tools.showError(getContext(), exception.toString(getContext()), exception.getCause());
|
||||
Throwable cause = exception.getCause();
|
||||
if(cause == null) {
|
||||
Tools.dialog(context, context.getString(R.string.global_error), exception.toString(context));
|
||||
}else {
|
||||
Tools.showError(context, exception.toString(context), exception.getCause());
|
||||
}
|
||||
}else {
|
||||
Tools.showError(getContext(), errorMessage);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public class MicrosoftBackgroundLogin {
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
Log.e("MicroAuth", e.toString());
|
||||
Log.e("MicroAuth", "Exception thrown during authentication", e);
|
||||
if(errorListener != null)
|
||||
Tools.runOnUiThread(() -> errorListener.onLoginError(e));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user