Catch non 200 response codes of WhatsApp tool
This commit is contained in:
@@ -51,8 +51,12 @@ public class WhatsAppNotifier {
|
|||||||
.build();
|
.build();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
client.send(req, HttpResponse.BodyHandlers.ofString()).body();
|
int responseCode = client.send(req, HttpResponse.BodyHandlers.ofString()).statusCode();
|
||||||
|
if (responseCode != 200) {
|
||||||
|
logger.error("Failed to send WhatsApp message. Response code: " + responseCode);
|
||||||
|
} else {
|
||||||
success = true;
|
success = true;
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Failed to send WhatsApp message: " + e.getMessage());
|
logger.error("Failed to send WhatsApp message: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user