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