.. _core-workflows: Workflows ========= These examples show the shared CORE helpers in application code. The module is intentionally small: it provides vocabulary and utilities rather than a framework-specific runtime. Report a structured error ------------------------- Use ``Diagnostic`` for client-facing failures and ``Exception`` when a failure must cross a C++ call boundary: .. code-block:: cpp #include #include snt::core::Diagnostic diagnostic; diagnostic.severity = snt::core::DiagnosticSeverity::Error; diagnostic.code = "app.invalid-input"; diagnostic.message = "The input value is outside the allowed range"; diagnostic.suggestion = "Choose a value between 0 and 1"; snt::core::SourceLocation location; location.source = "settings.dip"; location.line = 12; diagnostic.location = location; throw snt::core::Exception( diagnostic.message, diagnostic.details, diagnostic.suggestion, location.source, location.line ); The exception preserves the message, details, suggestion, and source location. Use ``error.info()`` when a caller needs the structured fields rather than the formatted ``what()`` text. Test data-type groups --------------------- Data-type flags make compatibility checks explicit: .. code-block:: cpp #include const auto accepted = snt::core::DataType::Integer | snt::core::DataType::Float; const auto actual = snt::core::DataType::Float64; const bool compatible = snt::core::any(actual & accepted); Use group flags for validation and keep the concrete flag when the exact storage type matters. Run a child process ------------------- Pass the executable and arguments separately, so shell expansion is never implicit: .. code-block:: cpp #include #include auto result = snt::core::process({"git", "--version"}); if (result.status == 0) std::cout << result.output; The result records the exit status and, when capture is enabled, the tail of the combined output. The caller decides whether a nonzero status is fatal.