Catch non 200 response codes of WhatsApp tool
This commit is contained in:
1 parent
a8e9327d3d
commit
f4748d2874
1 file changed
+6
-2
@@ -51,8 +51,12 @@ public class WhatsAppNotifier {
|
||||
.build();
|
||||
boolean success = false;
|
||||
try {
|
||||
client.send(req, HttpResponse.BodyHandlers.ofString()).body();
|
||||
success = true;
|
||||
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;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to send WhatsApp message: " + e.getMessage());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user