aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/error.hh
diff options
context:
space:
mode:
authorBen Burdette <bburdette@gmail.com>2020-05-07 16:43:36 -0600
committerBen Burdette <bburdette@gmail.com>2020-05-07 16:43:36 -0600
commit1b801cec407454b904466153dfc56cec6b433f4b (patch)
tree3a7439d05a0d92feaa2fa307a9485dbf4ce69e6a /src/libutil/error.hh
parente3901638b50d91ddc9c356adc35ded00a00fe94b (diff)
pretending to be const
Diffstat (limited to 'src/libutil/error.hh')
-rw-r--r--src/libutil/error.hh12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libutil/error.hh b/src/libutil/error.hh
index 2155ad344..19a806cc1 100644
--- a/src/libutil/error.hh
+++ b/src/libutil/error.hh
@@ -82,10 +82,10 @@ class BaseError : public std::exception
{
protected:
string prefix_; // used for location traces etc.
- ErrorInfo err;
+ mutable ErrorInfo err;
- std::optional<string> what_;
- const string& calcWhat()
+ mutable std::optional<string> what_;
+ const string& calcWhat() const
{
if (what_.has_value())
return *what_;
@@ -131,12 +131,12 @@ public:
#ifdef EXCEPTION_NEEDS_THROW_SPEC
~BaseError() throw () { };
- const char * what() throw () { return calcWhat().c_str(); }
+ const char * what() const throw () { return calcWhat().c_str(); }
#else
- const char * what() noexcept { return calcWhat().c_str(); }
+ const char * what() const noexcept override { return calcWhat().c_str(); }
#endif
- const string & msg() { return calcWhat(); }
+ const string & msg() const { return calcWhat(); }
const string & prefix() const { return prefix_; }
BaseError & addPrefix(const FormatOrString & fs);