Refactored constructor of Instance.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
cb7dee1ab7
commit
a6bd081280
|
@ -34,11 +34,14 @@ Instance::Instance(string hostname, string access_token)
|
|||
{
|
||||
try
|
||||
{
|
||||
debuglog << "Querying " << _hostname << " for max_toot_chars…\n";
|
||||
const auto answer{make_request(http_method::GET,
|
||||
_baseuri + "/api/v1/instance")};
|
||||
if (answer)
|
||||
if (!answer)
|
||||
{
|
||||
debuglog << "Querying instance for max_toot_chars…\n";
|
||||
return;
|
||||
}
|
||||
|
||||
_max_chars = [&answer]
|
||||
{
|
||||
auto &body{answer.body};
|
||||
|
@ -57,7 +60,6 @@ Instance::Instance(string hostname, string access_token)
|
|||
}();
|
||||
debuglog << "Set _max_chars to: " << _max_chars << '\n';
|
||||
}
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
debuglog << "Unexpected exception: " << e.what() << '\n';
|
||||
|
|
Loading…
Reference in New Issue
Block a user