1#ifndef SOURCEMETA_CORE_OPENAPI_ERROR_H_
2#define SOURCEMETA_CORE_OPENAPI_ERROR_H_
4#ifndef SOURCEMETA_CORE_OPENAPI_EXPORT
5#include <sourcemeta/core/openapi_export.h>
8#include <sourcemeta/core/json.h>
9#include <sourcemeta/core/jsonpointer.h>
17namespace sourcemeta::core {
24#pragma warning(disable : 4251 4275)
40class SOURCEMETA_CORE_OPENAPI_EXPORT
OpenAPIError :
public std::exception {
44 : location_{std::move(
location)}, message_{message} {}
52 : base_{std::move(
base)}, location_{std::move(
location)},
55 std::string message) =
delete;
57 std::string &&message) =
delete;
59 std::string_view message) =
delete;
61 [[nodiscard]]
auto what() const noexcept -> const
char *
override {
62 return this->message_;
68 return this->location_;
73 [[nodiscard]]
auto base() const noexcept ->
JSON::StringView {
98 :
public std::exception {
104 : base_{std::move(
base)}, location_{std::move(
location)},
105 identifier_{std::move(
identifier)}, message_{message} {}
110 std::string &&message) =
delete;
113 std::string_view message) =
delete;
115 [[nodiscard]]
auto what() const noexcept -> const
char *
override {
116 return this->message_;
121 return this->identifier_;
127 return this->location_;
131 [[nodiscard]]
auto base() const noexcept ->
JSON::StringView {
139 const char *message_;
157 :
public std::exception {
163 : base_{std::move(
base)}, location_{std::move(
location)},
164 identifier_{std::move(
identifier)}, message_{message} {}
169 std::string &&message) =
delete;
172 std::string_view message) =
delete;
174 [[nodiscard]]
auto what() const noexcept -> const
char *
override {
175 return this->message_;
180 return this->identifier_;
186 return this->location_;
190 [[nodiscard]]
auto base() const noexcept ->
JSON::StringView {
198 const char *message_;
213 :
public std::exception {
218 [[nodiscard]]
auto what() const noexcept -> const
char *
override {
219 return "The OpenAPI Description exceeds the maximum number of locations "
220 "that framing may register";
224 [[nodiscard]]
auto limit() const noexcept -> std::uint64_t {
229 std::uint64_t limit_;
244 :
public std::exception {
249 [[nodiscard]]
auto what() const noexcept -> const
char *
override {
250 return "The OpenAPI Description exceeds the maximum number of locations "
251 "that bundling may analyse";
255 [[nodiscard]]
auto limit() const noexcept -> std::uint64_t {
260 std::uint64_t limit_;
std::basic_string< Char, CharTraits, Allocator< Char > > String
The string type used by the JSON document.
Definition json_value.h:52
GenericPointer< JSON::String, PropertyHashJSON< JSON::String > > Pointer
Definition jsonpointer.h:39
auto location() const noexcept -> const Pointer &
Definition openapi_error.h:67
auto base() const noexcept -> JSON::StringView
Definition openapi_error.h:73
OpenAPIReferenceError(JSON::String base, Pointer location, JSON::String identifier, const char *message)
Definition openapi_error.h:161
OpenAPIError(Pointer location, const char *message)
Construct an error from where the problem is and a message.
Definition openapi_error.h:43
auto identifier() const noexcept -> JSON::StringView
The URI that nothing could produce a document for.
Definition openapi_error.h:120
auto base() const noexcept -> JSON::StringView
Get the base URI of the document that makes the reference.
Definition openapi_error.h:190
auto limit() const noexcept -> std::uint64_t
The maximum number of locations that framing was allowed to register.
Definition openapi_error.h:224
auto base() const noexcept -> JSON::StringView
Get the base URI of the document that makes the reference.
Definition openapi_error.h:131
OpenAPIError(JSON::String base, Pointer location, const char *message)
Definition openapi_error.h:51
auto location() const noexcept -> const Pointer &
Definition openapi_error.h:185
OpenAPIResolutionError(JSON::String base, Pointer location, JSON::String identifier, const char *message)
Definition openapi_error.h:102
OpenAPIBundleLimitError(const std::uint64_t limit)
Create a bundling limit error.
Definition openapi_error.h:247
OpenAPIFrameLimitError(const std::uint64_t limit)
Create a framing limit error.
Definition openapi_error.h:216
auto limit() const noexcept -> std::uint64_t
The maximum number of locations that bundling was allowed to register.
Definition openapi_error.h:255
auto location() const noexcept -> const Pointer &
Definition openapi_error.h:126
auto identifier() const noexcept -> JSON::StringView
The URI that the reference names, resolved and canonicalised.
Definition openapi_error.h:179