Replaced MastodonException and replaced it with CURLException.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2020-01-16 22:37:53 +01:00
parent 1f28d5b098
commit c60f7a379d
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
5 changed files with 3 additions and 30 deletions

View File

@ -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()

View File

@ -40,18 +40,7 @@ CURLException::CURLException(const int error)
const char *CURLException::what() const noexcept
{
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)};
static const string error_string{"libcurl error: " + to_string(error_code)};
return error_string.c_str();
}

View File

@ -49,17 +49,6 @@ public:
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
{
public:

View File

@ -122,11 +122,6 @@ int main(int argc, char *argv[])
cerr << e.what() << '\n';
return error::file;
}
catch (const MastodonException &e)
{
cerr << e.what() << '\n';
return error::mastodon;
}
catch (const HTTPException &e)
{
cerr << e.what() << '\n';

View File

@ -114,7 +114,7 @@ void MastoAPI::post_item(const Item &item)
{
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;