Throw logic error if switch doesn't handle case.

This commit is contained in:
tastytea 2020-03-06 06:27:29 +01:00
parent b7cedb6e7f
commit 25bef45181
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 7 additions and 0 deletions

View File

@ -40,6 +40,7 @@ using std::thread;
* @brief Interact with an account using the Mastodon API.
*
* @throw std::runtime_error No hashtag or list ID given.
* @throw std::logic_error Unhandled stream type. (Should never happen)
*
* @since 0.1.0
*
@ -97,6 +98,7 @@ public:
* @param id The hashtag or list id.
*
* @throw std::runtime_error hashtag or list ID given.
* @throw std::logic_error Unhandled stream type. (Should never happen)
*
* @since 0.1.0
*/
@ -109,6 +111,7 @@ public:
* @param id The hashtag or list id.
*
* @throw std::runtime_error No hashtag or list ID given.
* @throw std::logic_error Unhandled stream type. (Should never happen)
*
* @since 0.1.0
*/

View File

@ -17,11 +17,13 @@
#include "account_mastodon.hpp"
#include "version.hpp"
#include <exception>
#include <stdexcept>
namespace FediPotato
{
using std::logic_error;
using std::runtime_error;
MastodonAPI::MastodonAPI(const string_view application_name,
@ -91,6 +93,8 @@ string MastodonAPI::get_stream_id(const stream_type type,
break;
}
}
throw logic_error{"Unhandled stream type."};
}
} // namespace FediPotato