in ecosystem/error-handler/dingtalk/src/main/java/org/apache/shardingsphere/elasticjob/error/handler/dingtalk/DingtalkJobErrorHandler.java [78:96]
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 responseMessage = GsonFactory.getGson().fromJson(EntityUtils.toString(response.getEntity()), JsonObject.class);
if (!"0".equals(responseMessage.get("errcode").getAsString())) {
log.error("An exception has occurred in Job '{}' but failed to send dingtalk because of: {}", jobName, responseMessage.get("errmsg").getAsString(), cause);
} else {
log.info("An exception has occurred in Job '{}', an dingtalk message been sent successful.", jobName, cause);
}
} else {
log.error("An exception has occurred in Job '{}' but failed to send dingtalk 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 dingtalk because of", jobName, cause);
}
}