Skip to content

Commit

Permalink
More style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mdemoret-nv committed May 19, 2023
1 parent 1b4fbc1 commit 8bd3cc3
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions morpheus/_lib/include/morpheus/utilities/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,18 @@ namespace morpheus {
* This exception should not be thrown directly and is instead thrown by the
* MORPHEUS_EXPECTS macro.
*/
struct logic_error : public std::logic_error
struct LogicError : public std::logic_error
{
logic_error(char const* const message) : std::logic_error(message) {}
LogicError(char const* const message) : std::logic_error(message) {}

logic_error(std::string const& message) : std::logic_error(message) {}

// TODO Add an error code member? This would be useful for translating an
// exception to an error code in a pure-C API
LogicError(std::string const& message) : std::logic_error(message) {}
};
/**
* @brief Exception thrown when a CUDA error is encountered.
*/
struct cuda_error : public std::runtime_error
struct CudaError : public std::runtime_error
{
cuda_error(std::string const& message) : std::runtime_error(message) {}
CudaError(std::string const& message) : std::runtime_error(message) {}
};
/** @} */

Expand Down Expand Up @@ -100,17 +97,15 @@ struct cuda_error : public std::runtime_error
#define MORPHEUS_FAIL(reason) \
throw morpheus::logic_error("Morpheus failure at: " __FILE__ ":" MORPHEUS_STRINGIFY(__LINE__) ": " reason)

namespace morpheus {
namespace detail {
namespace morpheus::detail {

inline void throw_cuda_error(cudaError_t error, const char* file, unsigned int line)
{
throw morpheus::cuda_error(std::string{"CUDA error encountered at: " + std::string{file} + ":" +
std::to_string(line) + ": " + std::to_string(error) + " " +
cudaGetErrorName(error) + " " + cudaGetErrorString(error)});
throw morpheus::CudaError(std::string{"CUDA error encountered at: " + std::string{file} + ":" +
std::to_string(line) + ": " + std::to_string(error) + " " +
cudaGetErrorName(error) + " " + cudaGetErrorString(error)});
}
} // namespace detail
} // namespace morpheus
} // namespace morpheus::detail

/**
* @brief Error checking macro for CUDA runtime API functions.
Expand Down

0 comments on commit 8bd3cc3

Please sign in to comment.