Extend NetworkError to take a detail parameter.
authorCarl Hetherington <cth@carlh.net>
Mon, 13 Dec 2021 00:00:37 +0000 (01:00 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 13 Dec 2021 21:45:54 +0000 (22:45 +0100)
src/lib/exceptions.cc
src/lib/exceptions.h

index 3f87a2ebe142893bba046fca25075b7423716faa..7e98a2b57c4fd95c4ec5cd038a0f4f9bc9869851 100644 (file)
@@ -116,6 +116,15 @@ KDMAsContentError::KDMAsContentError ()
 }
 
 
+NetworkError::NetworkError (string s, string d)
+       : runtime_error (String::compose("%1 (%2)", s, d))
+       , _summary (s)
+       , _detail (d)
+{
+
+}
+
+
 KDMError::KDMError (string s, string d)
        : runtime_error (String::compose("%1 (%2)", s, d))
        , _summary (s)
index 9b7837a46bef89c695f0be7097a254566b8d8939..a8f095c22a2fba730ceb941286229424114d7236 100644 (file)
@@ -253,9 +253,19 @@ public:
 class NetworkError : public std::runtime_error
 {
 public:
-       explicit NetworkError (std::string s)
-               : std::runtime_error (s)
-       {}
+       explicit NetworkError (std::string s, std::string d = "");
+
+       std::string summary () const {
+               return _summary;
+       }
+
+       std::string detail () const {
+               return _detail;
+       }
+
+private:
+       std::string _summary;
+       std::string _detail;
 };