1#ifndef SOURCEMETA_CORE_URITEMPLATE_ERROR_H_
2#define SOURCEMETA_CORE_URITEMPLATE_ERROR_H_
4#ifndef SOURCEMETA_CORE_URITEMPLATE_EXPORT
5#include <sourcemeta/core/uritemplate_export.h>
8#include <sourcemeta/core/error.h>
16namespace sourcemeta::core {
18SOURCEMETA_CORE_ERROR_WARNINGS_PUSH
26 :
Error{
"The input is not a valid URI Template"}, column_{column} {}
29 [[nodiscard]]
auto column() const noexcept -> std::uint64_t {
34 std::uint64_t column_;
54 const std::string_view
right)
55 :
Error{
"Variable name mismatch when adding route"}, left_{
left},
59 [[nodiscard]]
auto left() const noexcept -> const std::
string & {
64 [[nodiscard]]
auto right() const noexcept -> const std::
string & {
84 [[nodiscard]]
auto segment() const noexcept -> const std::
string & {
85 return this->segment_;
95class SOURCEMETA_CORE_URITEMPLATE_EXPORT
103 [[nodiscard]]
auto operation_id() const noexcept -> const std::
string & {
104 return this->operation_id_;
108 std::string operation_id_;
114class SOURCEMETA_CORE_URITEMPLATE_EXPORT
123 [[nodiscard]]
auto operation_id() const noexcept -> const std::
string & {
124 return this->operation_id_;
128 std::string operation_id_;
138 std::filesystem::path
path)
142 [[nodiscard]]
auto path() const noexcept -> const std::filesystem::
path & {
147 std::filesystem::path path_;
157 :
Error{
"Failed to open router file for reading"},
158 path_{std::move(
path)} {}
161 [[nodiscard]]
auto path() const noexcept -> const std::filesystem::
path & {
166 std::filesystem::path path_;
169SOURCEMETA_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 segment() const noexcept -> const std::string &
Get the offending segment.
Definition uritemplate_error.h:84
auto operation_id() const noexcept -> const std::string &
Get the conflicting operation identifier.
Definition uritemplate_error.h:123
auto right() const noexcept -> const std::string &
Get the conflicting variable name.
Definition uritemplate_error.h:64
auto operation_id() const noexcept -> const std::string &
Get the offending operation identifier.
Definition uritemplate_error.h:103
URITemplateRouterDuplicateOperationIdError(const std::string_view operation_id)
Construct an error given the conflicting operation identifier.
Definition uritemplate_error.h:118
URITemplateRouterVariableMismatchError(const std::string_view left, const std::string_view right)
Construct an error given the existing and conflicting variable names.
Definition uritemplate_error.h:53
URITemplateRouterReadError(std::filesystem::path path)
Construct an error given the target path.
Definition uritemplate_error.h:156
URITemplateRouterInvalidOperationIdError(const std::string_view operation_id)
Construct an error given the offending operation identifier.
Definition uritemplate_error.h:99
URITemplateRouterInvalidSegmentError(const StaticString message, const std::string_view segment)
Construct an error given a descriptive message and the offending segment.
Definition uritemplate_error.h:79
auto left() const noexcept -> const std::string &
Get the existing variable name.
Definition uritemplate_error.h:59
auto column() const noexcept -> std::uint64_t
Get the column number of the error.
Definition uritemplate_error.h:29
URITemplateParseError(const std::uint64_t column) noexcept
Construct an error given the column number where parsing failed.
Definition uritemplate_error.h:25
URITemplateExpansionError(const StaticString message) noexcept
Construct an error with a descriptive message.
Definition uritemplate_error.h:43
URITemplateRouterSaveError(const StaticString message, std::filesystem::path path)
Construct an error given a descriptive message and the target path.
Definition uritemplate_error.h:137
auto path() const noexcept -> const std::filesystem::path &
Get the path that could not be read.
Definition uritemplate_error.h:161
auto path() const noexcept -> const std::filesystem::path &
Get the path that could not be saved.
Definition uritemplate_error.h:142