1#ifndef SOURCEMETA_CORE_YAML_ERROR_H_
2#define SOURCEMETA_CORE_YAML_ERROR_H_
4#ifndef SOURCEMETA_CORE_YAML_EXPORT
5#include <sourcemeta/core/yaml_export.h>
8#include <sourcemeta/core/error.h>
16namespace sourcemeta::core {
18SOURCEMETA_CORE_ERROR_WARNINGS_PUSH
34 :
Error{
"Failed to parse the YAML document"}, line_{line},
39 const std::uint64_t
column) noexcept
43 [[nodiscard]]
auto line() const noexcept -> std::uint64_t {
48 [[nodiscard]]
auto column() const noexcept -> std::uint64_t {
54 std::uint64_t column_;
63 const std::uint64_t
line,
const std::uint64_t
column)
69 path_{std::move(
path)} {}
72 [[nodiscard]]
auto path() const noexcept -> const std::filesystem::
path & {
77 std::filesystem::path path_;
87 const std::uint64_t
line,
const std::uint64_t
column)
89 anchor_name_{anchor_name} {}
92 [[nodiscard]]
auto anchor() const noexcept -> std::string_view {
93 return this->anchor_name_;
97 std::string anchor_name_;
109 const std::uint64_t
line,
const std::uint64_t
column)
111 key_name_{key_name} {}
114 [[nodiscard]]
auto key() const noexcept -> std::string_view {
115 return this->key_name_;
119 std::string key_name_;
122SOURCEMETA_CORE_ERROR_WARNINGS_POP
auto message() const noexcept -> StaticString
Definition error_base.h:78
Error(const StaticString message) noexcept
Construct the error given its message.
Definition error_base.h:84
Definition text_static_string.h:20
auto line() const noexcept -> std::uint64_t
Get the line number of the error.
Definition yaml_error.h:43
YAMLFileParseError(std::filesystem::path path, const YAMLParseError &parent)
Create a file parsing error from a parse error.
Definition yaml_error.h:67
YAMLFileParseError(const StaticString message, std::filesystem::path path, const std::uint64_t line, const std::uint64_t column)
Create a file parsing error.
Definition yaml_error.h:62
YAMLUnknownAnchorError(const std::string_view anchor_name, const std::uint64_t line, const std::uint64_t column)
Create an unknown anchor error.
Definition yaml_error.h:86
YAMLDuplicateKeyError(const std::string_view key_name, const std::uint64_t line, const std::uint64_t column)
Create a duplicate key error.
Definition yaml_error.h:108
auto anchor() const noexcept -> std::string_view
Get the anchor name of the error.
Definition yaml_error.h:92
YAMLError(const StaticString message) noexcept
Create a general error.
Definition yaml_error.h:25
YAMLParseError(const StaticString message, const std::uint64_t line, const std::uint64_t column) noexcept
Create a parsing error with a custom message.
Definition yaml_error.h:38
auto path() const noexcept -> const std::filesystem::path &
Get the file path of the error.
Definition yaml_error.h:72
YAMLParseError(const std::uint64_t line, const std::uint64_t column) noexcept
Create a parsing error.
Definition yaml_error.h:33
auto key() const noexcept -> std::string_view
Get the key name of the error.
Definition yaml_error.h:114
auto column() const noexcept -> std::uint64_t
Get the column number of the error.
Definition yaml_error.h:48