Throw logic error if switch doesn't handle case.
This commit is contained in:
parent
b7cedb6e7f
commit
25bef45181
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in New Issue