Skip to content

Commit

Permalink
cleanup exception class
Browse files Browse the repository at this point in the history
  • Loading branch information
mgates3 committed May 28, 2024
1 parent 5e6c205 commit 8334d35
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions include/slate/Exception.hh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ public:
/// Sets the what() message to msg with func, file, line appended.
Exception(std::string const& msg,
const char* func, const char* file, int line)
: std::exception(),
msg_(msg + " in " + func + " at " + file + ":" + std::to_string(line))
{}
: std::exception()
{
what( msg, func, file, line );
}

/// @return message describing the exception.
virtual char const* what() const noexcept override
Expand All @@ -40,12 +41,14 @@ public:

protected:
/// Sets the what() message to msg with func, file, line appended.
/// See MpiException in mpi.hh.
void what(std::string const& msg,
const char* func, const char* file, int line)
{
msg_ = msg + " in " + func + " at " + file + ":" + std::to_string(line);
}

private:
std::string msg_;
};

Expand All @@ -56,6 +59,7 @@ protected:
} while(0)

//------------------------------------------------------------------------------
/// Exception class for slate_not_implemented().
class NotImplemented : public Exception {
public:
NotImplemented(const char* msg,
Expand Down

0 comments on commit 8334d35

Please sign in to comment.