Archetype: cpp_service_config_parser_exception.hpp.mustache

Table of Contents

Exception type for parse failures. component-service profile.

See the Template variable reference for the complete list of available variables and their semantics.

Template

The full template source. Edit here and re-tangle with compass build --direct tangle_codegen_templates to regenerate library/templates/cpp_service_config_parser_exception.hpp.mustache.

{{! GENERATED FILE — tangled from projects/ores.codegen/library/templates/cpp_service_app.org. Edit the org source. }}
{{{cpp_license}}}
{{#component}}
#ifndef {{full_name_upper}}_CONFIG_PARSER_EXCEPTION_HPP
#define {{full_name_upper}}_CONFIG_PARSER_EXCEPTION_HPP

#include <string>
#include <boost/exception/info.hpp>

namespace {{namespace}}::config {

/**
 * @brief A fatal error has occurred during option parsing.
 */
class parser_exception : public virtual std::exception,
                         public virtual boost::exception {
public:
    explicit parser_exception(std::string_view message = "")
        : message_(message) {}

    [[nodiscard]] const char* what() const noexcept override {
        return message_.c_str();
    }

private:
    std::string message_;
};

}

#endif
{{/component}}

See also

Emacs 29.1 (Org mode 9.6.6)