зеркало из https://github.com/mozilla/pjs.git
Bug 722553 - uniformize JPakeClientStage error handling. r=rnewman
This commit is contained in:
Родитель
89e8275e9f
Коммит
7b68bb1bdc
|
@ -21,6 +21,7 @@ public class ComputeKeyVerificationStage extends JPakeStage {
|
|||
if (jClient.myKeyBundle == null) {
|
||||
Logger.error(LOG_TAG, "KeyBundle has not been set; aborting.");
|
||||
jClient.abort(Constants.JPAKE_ERROR_INTERNAL);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
jClient.jOutgoing = computeKeyVerification(jClient.myKeyBundle, jClient.mySignerId);
|
||||
|
|
|
@ -52,13 +52,16 @@ public class GetChannelStage extends JPakeStage {
|
|||
|
||||
@Override
|
||||
public void handleFailure(String error) {
|
||||
Logger.error(LOG_TAG, "Got HTTP failure: " + error);
|
||||
jClient.abort(error);
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleError(Exception e) {
|
||||
Logger.error(LOG_TAG, "Threw HTTP exception.", e);
|
||||
jClient.abort(Constants.JPAKE_ERROR_CHANNEL);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -67,9 +70,11 @@ public class GetChannelStage extends JPakeStage {
|
|||
} catch (URISyntaxException e) {
|
||||
Logger.error(LOG_TAG, "Incorrect URI syntax.", e);
|
||||
jClient.abort(Constants.JPAKE_ERROR_INVALID);
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
Logger.error(LOG_TAG, "Unexpected exception.", e);
|
||||
jClient.abort(Constants.JPAKE_ERROR_INTERNAL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,13 +73,16 @@ public class GetRequestStage extends JPakeStage {
|
|||
|
||||
@Override
|
||||
public void handleFailure(String error) {
|
||||
Logger.error(LOG_TAG, "Got HTTP failure: " + error);
|
||||
jClient.abort(error);
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleError(Exception e) {
|
||||
Logger.error(LOG_TAG, "Threw HTTP exception.", e);
|
||||
jClient.abort(Constants.JPAKE_ERROR_NETWORK);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -58,13 +58,16 @@ public class PutRequestStage extends JPakeStage {
|
|||
|
||||
@Override
|
||||
public void handleFailure(String error) {
|
||||
Logger.error(LOG_TAG, "Got HTTP failure: " + error);
|
||||
jClient.abort(error);
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleError(Exception e) {
|
||||
Logger.error(LOG_TAG, "HTTP exception.", e);
|
||||
jClient.abort(Constants.JPAKE_ERROR_NETWORK);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -81,7 +84,9 @@ public class PutRequestStage extends JPakeStage {
|
|||
try {
|
||||
putRequest.put(JPakeClient.jsonEntity(jClient.jOutgoing.object));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
Logger.error(LOG_TAG, "UnsupportedEncodingException", e);
|
||||
jClient.abort(Constants.JPAKE_ERROR_INTERNAL);
|
||||
return;
|
||||
}
|
||||
Logger.debug(LOG_TAG, "Outgoing message: " + jClient.jOutgoing.toJSONString());
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ public class VerifyPairingStage extends JPakeStage {
|
|||
} else {
|
||||
Logger.error(LOG_TAG, "Keys don't match.");
|
||||
jClient.abort(Constants.JPAKE_ERROR_KEYMISMATCH);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче