IncludeJS  0.0.1
Build your own JavaScript runtime
engine_error.h
1 #ifndef INCLUDEJS_ENGINE_ERROR_H_
2 #define INCLUDEJS_ENGINE_ERROR_H_
3 
4 #include "engine_export.h"
5 
6 #include <exception> // std::exception
7 #include <filesystem> // std::filesystem::path
8 #include <optional> // std::optional
9 #include <string> // std::string
10 #include <vector> // std::vector
11 
12 namespace includejs {
14 struct INCLUDEJS_ENGINE_EXPORT Frame {
15  const std::optional<std::string> scope;
16  const std::optional<std::filesystem::path> path;
17  const unsigned long long line;
18  const unsigned long long column;
19 };
20 
22 class INCLUDEJS_ENGINE_EXPORT Error : public std::exception {
23 private:
24  using FrameContainer = std::vector<Frame>;
25 
26 public:
27  Error(std::string &&message, FrameContainer &&stacktrace);
28  auto what() const noexcept -> const char * override;
29  auto begin() const -> FrameContainer::const_iterator;
30  auto end() const -> FrameContainer::const_iterator;
31 
32 private:
33  const std::string message;
34  const FrameContainer stacktrace;
35 };
36 } // namespace includejs
37 
38 #endif
Definition: engine_error.h:22
Definition: engine_error.h:14