auto const r = curl_easy_perform (curl);
if (r != CURLE_OK) {
- throw NetworkError (_("Failed to send email"), curl_easy_strerror(r));
+ throw NetworkError (_("Failed to send email"), string(curl_easy_strerror(r)));
}
curl_slist_free_all (recipients);
}
-NetworkError::NetworkError (string s, string d)
- : runtime_error (String::compose("%1 (%2)", s, d))
+NetworkError::NetworkError (string s, optional<string> d)
+ : runtime_error (String::compose("%1%2", s, d ? String::compose(" (%1)", *d) : ""))
, _summary (s)
, _detail (d)
{
class NetworkError : public std::runtime_error
{
public:
- explicit NetworkError (std::string s, std::string d = "");
+ explicit NetworkError (std::string s, boost::optional<std::string> d = boost::optional<std::string>());
std::string summary () const {
return _summary;
}
- std::string detail () const {
+ boost::optional<std::string> detail () const {
return _detail;
}
private:
std::string _summary;
- std::string _detail;
+ boost::optional<std::string> _detail;
};