Skip to content

Commit

Permalink
Fix reference to temporary error in UnsupportedType exception (#195)
Browse files Browse the repository at this point in the history
Signed-off-by: Rhys Mainwaring <[email protected]>
  • Loading branch information
srmainwaring committed Jun 29, 2023
1 parent 671182f commit 3a10798
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,20 @@ class UnsupportedType : public std::exception
: std::exception()
, type_name_(type_name)
{
std::ostringstream err;
err << "[json-xtypes] Unsupported type '" << type_name_ << "'";
err_str_ = err.str();
}

const char* what() const noexcept
{
std::ostringstream err;
err << "[json-xtypes] Unsupported type '" << type_name_ << "'";
return err.str().c_str();
return err_str_.c_str();
}

private:

const std::string type_name_;

std::string err_str_;
};

/**
Expand Down

0 comments on commit 3a10798

Please sign in to comment.