Replaced MastodonException and replaced it with CURLException.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
1f28d5b098
commit
c60f7a379d
|
@ -214,7 +214,7 @@ string Config::get_access_token(const string &instance) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw MastodonException{ret.curl_error_code};
|
throw CURLException{ret.curl_error_code};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::parse()
|
void Config::parse()
|
||||||
|
|
|
@ -40,18 +40,7 @@ CURLException::CURLException(const int error)
|
||||||
|
|
||||||
const char *CURLException::what() const noexcept
|
const char *CURLException::what() const noexcept
|
||||||
{
|
{
|
||||||
static const string error_string{"libCURL error: " + to_string(error_code)};
|
static const string error_string{"libcurl error: " + to_string(error_code)};
|
||||||
return error_string.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
MastodonException::MastodonException(const int error)
|
|
||||||
: error_code{static_cast<uint16_t>(error)}
|
|
||||||
{}
|
|
||||||
|
|
||||||
const char *MastodonException::what() const noexcept
|
|
||||||
{
|
|
||||||
static const string error_string{"Mastodon error: "
|
|
||||||
+ to_string(error_code)};
|
|
||||||
return error_string.c_str();
|
return error_string.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,17 +49,6 @@ public:
|
||||||
const char *what() const noexcept override;
|
const char *what() const noexcept override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MastodonException : public exception
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
const uint16_t error_code;
|
|
||||||
|
|
||||||
explicit MastodonException(int error);
|
|
||||||
|
|
||||||
[[nodiscard]]
|
|
||||||
const char *what() const noexcept override;
|
|
||||||
};
|
|
||||||
|
|
||||||
class FileException : public exception
|
class FileException : public exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -122,11 +122,6 @@ int main(int argc, char *argv[])
|
||||||
cerr << e.what() << '\n';
|
cerr << e.what() << '\n';
|
||||||
return error::file;
|
return error::file;
|
||||||
}
|
}
|
||||||
catch (const MastodonException &e)
|
|
||||||
{
|
|
||||||
cerr << e.what() << '\n';
|
|
||||||
return error::mastodon;
|
|
||||||
}
|
|
||||||
catch (const HTTPException &e)
|
catch (const HTTPException &e)
|
||||||
{
|
{
|
||||||
cerr << e.what() << '\n';
|
cerr << e.what() << '\n';
|
||||||
|
|
|
@ -114,7 +114,7 @@ void MastoAPI::post_item(const Item &item)
|
||||||
{
|
{
|
||||||
throw HTTPException{ret.http_status};
|
throw HTTPException{ret.http_status};
|
||||||
}
|
}
|
||||||
throw MastodonException{ret.curl_error_code};
|
throw CURLException{ret.curl_error_code};
|
||||||
}
|
}
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Posted status with GUID: " << item.guid;
|
BOOST_LOG_TRIVIAL(debug) << "Posted status with GUID: " << item.guid;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue