Permalink
Browse files

Return network errors in onFailure callback during SDK initialization

  • Loading branch information...
1 parent 86fd4a8 commit ceb927e7d3db80ac82d0b1d6784c6037ffc8e896 @capflam capflam committed Feb 6, 2014
Showing with 14 additions and 14 deletions.
  1. +14 −14 sdk/src/com/scoreflex/Scoreflex.java
View
28 sdk/src/com/scoreflex/Scoreflex.java
@@ -327,13 +327,13 @@ public void run() {
.fetchAnonymousAccessTokenIfNeeded(new ResponseHandler() {
@Override
public void onFailure(Throwable e, Response errorResponse) {
- if (errorResponse != null) {
- Intent broadcast = new Intent(INTENT_SCOREFLEX_INTIALIZE_FAILED);
- JSONParcelable parcelable = new JSONParcelable(errorResponse.getJSONObject());
- broadcast.putExtra(INTENT_SCOREFLEX_INTIALIZE_FAILED_EXTRA_REASON, parcelable);
- LocalBroadcastManager.getInstance(
- Scoreflex.getApplicationContext()).sendBroadcast(broadcast);
- }
+ Intent broadcast = new Intent(INTENT_SCOREFLEX_INTIALIZE_FAILED);
+ if (errorResponse != null) {
+ JSONParcelable parcelable = new JSONParcelable(errorResponse.getJSONObject());
+ broadcast.putExtra(INTENT_SCOREFLEX_INTIALIZE_FAILED_EXTRA_REASON, parcelable);
+ }
+ LocalBroadcastManager.getInstance(
+ Scoreflex.getApplicationContext()).sendBroadcast(broadcast);
}
@Override
@@ -350,14 +350,14 @@ public void onSuccess(Response response) {
Scoreflex.get("/network/ping", null, new ResponseHandler() {
@Override
public void onFailure(Throwable e, Response errorResponse) {
- if (errorResponse != null) {
- Intent broadcast = new Intent(INTENT_SCOREFLEX_INTIALIZE_FAILED);
- JSONParcelable parcelable = new JSONParcelable(errorResponse.getJSONObject());
- broadcast.putExtra(INTENT_SCOREFLEX_INTIALIZE_FAILED_EXTRA_REASON, parcelable);
- LocalBroadcastManager.getInstance(
- Scoreflex.getApplicationContext()).sendBroadcast(broadcast);
+ Intent broadcast = new Intent(INTENT_SCOREFLEX_INTIALIZE_FAILED);
+ if (errorResponse != null) {
+ JSONParcelable parcelable = new JSONParcelable(errorResponse.getJSONObject());
+ broadcast.putExtra(INTENT_SCOREFLEX_INTIALIZE_FAILED_EXTRA_REASON, parcelable);
+ }
+ LocalBroadcastManager.getInstance(
+ Scoreflex.getApplicationContext()).sendBroadcast(broadcast);
}
- }
@Override
public void onSuccess(Response response) {

0 comments on commit ceb927e

Please sign in to comment.