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:
2025-11-19 16:37:46 -08:00
parent fa91fd02e8
commit ca59169116
11 changed files with 134 additions and 121 deletions

View File

@@ -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;