Blaze 0.0.1
The ultra high-performance JSON Schema evaluator
Loading...
Searching...
No Matches
configuration_error.h
1#ifndef SOURCEMETA_BLAZE_CONFIGURATION_ERROR_H_
2#define SOURCEMETA_BLAZE_CONFIGURATION_ERROR_H_
3
4#ifndef SOURCEMETA_BLAZE_CONFIGURATION_EXPORT
5#include <sourcemeta/blaze/configuration_export.h>
6#endif
7
8#include <sourcemeta/core/jsonpointer.h>
9
10#include <exception> // std::exception
11#include <string> // std::string
12#include <string_view> // std::string_view
13#include <utility> // std::move
14
15namespace sourcemeta::blaze {
16
17// Exporting symbols that depends on the standard C++ library is considered
18// safe.
19// https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4275?view=msvc-170&redirectedfrom=MSDN
20#if defined(_MSC_VER)
21#pragma warning(disable : 4251 4275)
22#endif
23
25class SOURCEMETA_BLAZE_CONFIGURATION_EXPORT ConfigurationParseError
26 : public std::exception {
27public:
28 ConfigurationParseError(const char *message,
29 sourcemeta::core::Pointer location)
30 : message_{message}, location_{std::move(location)} {}
31 ConfigurationParseError(std::string message,
32 sourcemeta::core::Pointer location) = delete;
33 ConfigurationParseError(std::string &&message,
34 sourcemeta::core::Pointer location) = delete;
35 ConfigurationParseError(std::string_view message,
36 sourcemeta::core::Pointer location) = delete;
37
38 [[nodiscard]] auto what() const noexcept -> const char * override {
39 return this->message_;
40 }
41
42 [[nodiscard]] auto location() const noexcept -> const auto & {
43 return this->location_;
44 }
45
46private:
47 const char *message_;
48 sourcemeta::core::Pointer location_;
49};
50
51#if defined(_MSC_VER)
52#pragma warning(default : 4251 4275)
53#endif
54
55} // namespace sourcemeta::blaze
56
57#endif