File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change 66
77#include < fmt/format.h>
88
9+ namespace {
10+
11+ [[nodiscard]] std::string result_to_string (const discordpp::ClientResult& result) {
12+ const auto error_type = result.Type ();
13+
14+ if (error_type == discordpp::ErrorType::None) {
15+ return " None" ;
16+ }
17+
18+ if (error_type == discordpp::ErrorType::HTTPError) {
19+ return fmt::format (
20+ " ErrorType: {} Message: {} Status: {} ErrorCode: {}" , discordpp::EnumToString (error_type),
21+ result.Error (), discordpp::EnumToString (result.Status ()), result.ErrorCode ()
22+ );
23+ }
24+
25+ return fmt::format (" ErrorType: {} Message: {}" , discordpp::EnumToString (error_type), result.Error ());
26+ }
27+
28+ } // namespace
29+
30+
931[[nodiscard]] std::string constants::discord ::get_asset_key (constants::discord::ArtAsset asset) {
1032
1133 switch (asset) {
@@ -63,7 +85,7 @@ void DiscordInstance::after_ready() {
6385 return ;
6486 }
6587
66- spdlog::error (" Current Connected User Error: {}" , result. ToString ( ));
88+ spdlog::error (" Current Connected User Error: {}" , result_to_string (result ));
6789 }
6890 );
6991
@@ -122,7 +144,7 @@ void DiscordInstance::set_activity(DiscordActivityWrapper activity) {
122144 if (result.Successful ()) {
123145 spdlog::info (" Rich Presence updated successfully" );
124146 } else {
125- spdlog::error (" Rich Presence update failed: {}" , result. ToString ( ));
147+ spdlog::error (" Rich Presence update failed: {}" , result_to_string (result ));
126148 }
127149 });
128150}
You can’t perform that action at this time.
0 commit comments