in ecosystem/error-handler/wechat/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/wechat/WechatJobErrorHandler.java [64:82]
public void handleException(final String jobName, final Throwable cause) {
HttpPost httpPost = createHTTPPostMethod(jobName, cause);
try (CloseableHttpResponse response = httpclient.execute(httpPost)) {
int status = response.getStatusLine().getStatusCode();
if (HttpURLConnection.HTTP_OK == status) {
JsonObject resp = GsonFactory.getGson().fromJson(EntityUtils.toString(response.getEntity()), JsonObject.class);
if (!"0".equals(resp.get("errcode").getAsString())) {
log.error("An exception has occurred in Job '{}' but failed to send wechat because of: {}", jobName, resp.get("errmsg").getAsString(), cause);
} else {
log.info("An exception has occurred in Job '{}', an wechat message has been sent successful.", jobName, cause);
}
} else {
log.error("An exception has occurred in Job '{}' but failed to send wechat because of: unexpected http response status: {}", jobName, status, cause);
}
} catch (final IOException ex) {
cause.addSuppressed(ex);
log.error("An exception has occurred in Job '{}' but failed to send wechat because of", jobName, cause);
}
}