OpenPine C++ API
C++ wrapper for the OpenPine Pine Script VM
Loading...
Searching...
No Matches
error.hpp
Go to the documentation of this file.
1#pragma once
2
7
8#if (defined(_MSVC_LANG) ? _MSVC_LANG : __cplusplus) < 201703L
9#error "OpenPine C++ wrapper headers require C++17 (std::optional)."
10#endif
11
12#include <optional>
13#include <string>
14
15#include "types.hpp"
16
17namespace openpine {
18
25class Error {
26 private:
27 std::string error_message_;
28 std::optional<Span> span_;
29
30 public:
31 Error(const char* error_message, const Span* span)
32 : error_message_(error_message),
33 span_(span ? std::make_optional(*span) : std::nullopt) {}
34
39 const std::string& errorMessage() const { return error_message_; }
40
45 const std::optional<Span>& span() const { return span_; }
46};
47
48} // namespace openpine
const std::string & errorMessage() const
Gets the error message.
Definition error.hpp:39
const std::optional< Span > & span() const
Gets the error span if available.
Definition error.hpp:45
Error(const char *error_message, const Span *span)
Definition error.hpp:31
Re-exports FFI types into the openpine namespace.