pushmsg: Proper exit code on HTTP error, fix documentation.
This commit is contained in:
parent
196652762f
commit
1850f7b112
@ -39,7 +39,7 @@ void read_options(int argc, char *argv[])
|
||||
("message", po::value<std::string>()->required(), "Message body.")
|
||||
("priority", po::value<std::int16_t>(),
|
||||
"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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user