Document exceptions in the function they could be thrown from,

and in the class description.
This commit is contained in:
tastytea 2020-03-06 06:12:47 +01:00
parent e21dd1f95e
commit 821622fccd
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
4 changed files with 30 additions and 16 deletions

View File

@ -39,6 +39,8 @@ using std::thread;
/*!
* @brief Interact with an account using the Mastodon API.
*
* @throw std::runtime_error No hashtag or list ID given.
*
* @since 0.1.0
*
* @headerfile account_mastodon.hpp FediPotato/account_mastodon.hpp
@ -94,6 +96,8 @@ public:
* @param type What to stream.
* @param id The hashtag or list id.
*
* @throw std::runtime_error hashtag or list ID given.
*
* @since 0.1.0
*/
void start_stream(stream_type type, optional<string_view> id);
@ -104,6 +108,8 @@ public:
* @param type What to stream.
* @param id The hashtag or list id.
*
* @throw std::runtime_error No hashtag or list ID given.
*
* @since 0.1.0
*/
void stop_stream(stream_type type, optional<string_view> id);

View File

@ -40,6 +40,11 @@ using std::string_view;
/*!
* @brief Read and write the configuration.
*
* @throw std::ifstream::failure Could not read from file.
* @throw std::ofstream::failure Could not write to file.
* @throw nlohmann::detail::parse_error Could not parse file.
* @throw nlohmann::detail::type_error Setting not found / Wrong type.
*
* @since 0.1.0
*
* @headerfile config.hpp FediPotato/config.hpp
@ -52,11 +57,6 @@ public:
*
* @param application_name The name of your application.
* @param filename The filename to open.
* @throw std::ifstream::failure Could not read from file
* @throw std::ofstream::failure Could not write to file
* @throw nlohmann::detail::parse_error Could not parse file
* @throw nlohmann::detail::type_error Setting not found / Wrong type
*
* @since 0.1.0
*/
@ -87,6 +87,9 @@ public:
/*!
* @brief Read and parse the configuration from file.
*
* @throw std::ifstream::failure Could not read from file.
* @throw nlohmann::detail::parse_error Could not parse file.
*
* @since 0.1.0
*/
void read();
@ -104,6 +107,8 @@ public:
* @param key The key of the setting.
* @param value The value of the setting.
*
* @throw std::ofstream::failure Could not write to file.
*
* @since 0.1.0
*/
inline void set(const string_view key, const string_view value)
@ -116,6 +121,8 @@ public:
*
* @param key The key of the setting.
*
* @throw nlohmann::detail::type_error Setting not found / Wrong type.
*
* @since 0.1.0
*/
[[nodiscard]]

View File

@ -37,6 +37,9 @@ namespace fs = std::filesystem;
/*!
* @brief Find the proper directories.
*
* @throw std::runtime_error Directory not found.
* @throw std::filesystem::filesystem_error Could not create directory.
*
* @since 0.1.0
*
* @headerfile directories.hpp FediPotato/directories.hpp
@ -50,9 +53,6 @@ public:
* @param application_name The name of your application. Is appended to
* all returned directories.
*
* @throw std::runtime_error Directory not found
* @throw std::filesystem::filesystem_error Could not create directory
*
* @since 0.1.0
*/
explicit Directories(const string_view application_name)
@ -78,6 +78,9 @@ public:
/*!
* @brief Return the directory for config files.
*
* @throw std::runtime_error Directory not found.
* @throw std::filesystem::filesystem_error Could not create directory.
*
* @since 0.1.0
*/
[[nodiscard]]

View File

@ -33,6 +33,8 @@ using std::string_view;
/*!
* @brief High-level interface to fediverse accounts and their data.
*
* For possible exceptions see Directories, Config and MastodonAPI.
*
* @since 0.1.0
*
* @headerfile fedipotato.hpp FediPotato/fedipotato.hpp
@ -43,8 +45,6 @@ public:
/*!
* @brief Construct a FediPotato object.
*
* For possible exceptions see Directories and Config.
*
* @param application_name The name of your application. Influences the
* file paths for all the data that is stored.
*
@ -150,15 +150,13 @@ private:
*
* @section exceptions Exceptions
*
* We throw exceptions. Consult the documentation for the class constructors
* you use for further information.
* We throw exceptions. Consult the class descriptions for more information.
*
* @section thread_safety Thread safety
*
* The first time you construct a FIXME,
* [curl_global_init(3)](https://curl.haxx.se/libcurl/c/curl_global_init.html)
* is called. When the last FIXME is
* destroyed, [curl_global_cleanup(3)]
* The first time you construct a MastodonAPI, [curl_global_init(3)]
* (https://curl.haxx.se/libcurl/c/curl_global_init.html) is called. When the
* last MastodonAPI is destroyed, [curl_global_cleanup(3)]
* (https://curl.haxx.se/libcurl/c/curl_global_cleanup.html) is called. Both
* are not thread safe.
*