nerr.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include <unordered_map>
5
9#include "core/type/ntype.hpp"
11
12namespace by {
13
14 typedef std::unordered_map<nidx, std::string> msgMap;
15
16 class pos;
17
18 struct _nout nerr: public baseErr {
19 BY(CLASS(nerr, baseErr))
20 template <typename T, nbool> friend struct tmarshaling;
21
22 public:
23 nerr(errLv::level t, nint newCode);
24 nerr(errLv::level t, nint newCode, va_list args);
25 nerr(errLv::level t, const point& ps, nint newCode, va_list args);
26 nerr(const me& rhs);
27
28 protected:
31
32 public:
33 nbool operator==(const super& rhs) const override;
34
35 public:
36 const baseObj& getOrigin() const override;
37
38 void log() const override;
39 void logStack() const override;
40 const std::string& getMsg() const override;
41 errCode getErrCode() const;
42 const point& getPos() const;
43
44 static const nerr& singleton();
45 static const std::string& getErrMsg(errCode code);
46 static const std::string& getErrName(errCode code);
47 static nerr* newErr(int code, ...);
48 static nerr* newErr(int code, va_list args);
49 static nerr* newErr(const point& src, int code, ...);
50 static nerr* newErr(const point& src, int code, va_list args);
51 static nerr* newWarn(int code, ...);
52 static nerr* newWarn(int code, va_list args);
53 static nerr* newWarn(const point& src, int code, ...);
54 static nerr* newWarn(const point& src, int code, va_list args);
55 static nerr* newInfo(int code, ...);
56 static nerr* newInfo(int code, va_list args);
57 static nerr* newInfo(const point& src, int code, ...);
58 static nerr* newInfo(const point& src, int code, va_list args);
59
60 private:
61 void _logNativeStack() const;
62
63 private:
64 errCode _code;
65 point _pos;
66 std::string _msg;
67 };
68
69 struct _nout ndummyErr: public nerr {
70 BY(CLASS(ndummyErr, nerr))
71
72 public:
73 ndummyErr();
74
75 public:
76 void log() const override;
77 const std::string& getMsg() const override;
78 };
79} // namespace by
Function call arguments container.
Definition: args.hpp:13
Base class for all error types.
Definition: baseErr.hpp:12
Base class for all objects in byeol language.
Definition: baseObj.hpp:24
Source location information.
Definition: src.hpp:11
Definition: nerr.hpp:69
Definition: nerr.hpp:18
void logStack() const override
Log error with stack trace.
void log() const override
Log error message.
nerr()
@hidden this's only available to marsharling.
Source code position tracking structure.
Definition: point.hpp:11
Template marshaling interface for C++ bridge.
Definition: tmarshaling.hpp:18