Skip to content

Commit

Permalink
Improve error message of the failure of getting prepayid.
Browse files Browse the repository at this point in the history
  • Loading branch information
zxkane committed Nov 28, 2015
1 parent 379aae9 commit b19dc7b
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -835,9 +835,8 @@ public WxMpPrepayIdResult getPrepayId(final Map<String, String> parameters) {
WxMpPrepayIdResult wxMpPrepayIdResult = (WxMpPrepayIdResult) xstream.fromXML(responseContent);
return wxMpPrepayIdResult;
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException("Failed to get prepay id due to IO exception.", e);
}
return new WxMpPrepayIdResult();
}

final String[] REQUIRED_ORDER_PARAMETERS = new String[] { "appid", "mch_id", "body", "out_trade_no", "total_fee", "spbill_create_ip", "notify_url",
Expand Down Expand Up @@ -875,7 +874,7 @@ public Map<String, String> getJSSDKPayInfo(Map<String, String> parameters) {
WxMpPrepayIdResult wxMpPrepayIdResult = getPrepayId(parameters);
String prepayId = wxMpPrepayIdResult.getPrepay_id();
if (prepayId == null || prepayId.equals("")) {
throw new RuntimeException("get prepayid error");
throw new RuntimeException(String.format("Failed to get prepay id due to error code '%s'(%s).", wxMpPrepayIdResult.getErr_code(), wxMpPrepayIdResult.getErr_code_des()));
}

Map<String, String> payInfo = new HashMap<String, String>();
Expand Down

0 comments on commit b19dc7b

Please sign in to comment.