container: root: rewrite throw handler, refactor using common types
- Refactor using common types that were once internal - Removes ancient macro approaches to C++20 solutions - Changes `Exception` message type to use std::string * std::string_view isn't worthwhile in this context
This commit is contained in:
@@ -184,7 +184,7 @@ class Meta final
|
||||
//! \param column Existing CSV metadata column
|
||||
static void meta_sample(const std::string& column)
|
||||
{
|
||||
namespace common = ::dfi::macro::common;
|
||||
namespace common = ::dfi::common;
|
||||
|
||||
// Import meta file
|
||||
const std::string path{common::get_env("global_conf_meta")};
|
||||
@@ -197,14 +197,12 @@ class Meta final
|
||||
available += "\n\t" + col;
|
||||
available += "\n";
|
||||
|
||||
if (!csv->HasColumn(column))
|
||||
throw std::runtime_error(
|
||||
std::string{"\n\nAvailable columns: " + available}.c_str());
|
||||
common::throw_ex_if<common::type::RuntimeError>(
|
||||
!csv->HasColumn(column), "\n\nAvailable columns: " + available);
|
||||
|
||||
// Aggregate all rows of given column
|
||||
auto count = csv->Count();
|
||||
if (!*count)
|
||||
throw std::runtime_error("Empty CSV");
|
||||
common::throw_ex_if<common::type::RuntimeError>(!*count, "Empty CSV");
|
||||
|
||||
// Prepare canvas data
|
||||
Meta::CanvasData data;
|
||||
|
||||
Reference in New Issue
Block a user