From 1850f7b11281a6ab94d365fa66670b946acbd7c6 Mon Sep 17 00:00:00 2001 From: tastytea Date: Mon, 13 Sep 2021 12:46:33 +0200 Subject: [PATCH] pushmsg: Proper exit code on HTTP error, fix documentation. --- pushmsg.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pushmsg.cpp b/pushmsg.cpp index 2405afa..72c3044 100644 --- a/pushmsg.cpp +++ b/pushmsg.cpp @@ -39,7 +39,7 @@ void read_options(int argc, char *argv[]) ("message", po::value()->required(), "Message body.") ("priority", po::value(), "Priority of the message. Default is 5. " - "0 = no notification, 1-3 = silent, 4-7 = sound, 8-10 = popup."); + "0 = hidden notification, 1-3 = silent, 4-7 = sound, 8-10 = popup."); // clang-format on po::variables_map vm; @@ -89,11 +89,13 @@ int main(int argc, char *argv[]) {"priority", message.priority}}; const auto response{ conn.post("/message?token=" + message.token, json.dump())}; + RestClient::disable(); switch (response.code) { case 200: { + return 0; break; } case 400: @@ -127,12 +129,11 @@ int main(int argc, char *argv[]) break; } } - - RestClient::disable(); } catch (const std::exception &e) { cerr << e.what() << '\n'; - return 1; } + + return 1; }