MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / luaD_throw

Function luaD_throw

src/Chain/libraries/glua/ldo.cpp:129–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127
128
129void luaD_throw(lua_State *L, int errcode) {
130 if (L->errorJmp) { // thread has an error handler?
131 L->errorJmp->status = errcode; // set status
132 LUAI_THROW(L, L->errorJmp); // jump to it
133 }
134 else { // thread has no error handler
135 global_State *g = G(L);
136 L->status = cast_byte(errcode); // mark it as dead
137 if (g->mainthread->errorJmp) { // main thread has a handler?
138 setobjs2s(L, g->mainthread->top++, L->top - 1); // copy error obj.
139 luaD_throw(g->mainthread, errcode); // re-throw in main thread
140 }
141 else { // no handler at all; abort
142 std::string errmsg;
143 if (g->panic) { // panic function?
144 seterrorobj(L, errcode, L->top); // assume EXTRA_STACK
145 if (L->ci->top < L->top)
146 L->ci->top = L->top; // pushing msg. can break this invariant
147 lua_unlock(L);
148 errmsg = geterrorobjstr(L, errcode);
149 g->panic(L); // call panic function (last chance to jump out)
150 }
151 else
152 {
153 errmsg = "not found global function";
154 }
155 // abort();
156 global_glua_chain_api->throw_exception(L, THINKYOUNG_API_SIMPLE_ERROR, errmsg.c_str());
157 thinkyoung::lua::lib::notify_lua_state_stop(L);
158 L->force_stopping = true;
159 }
160 }
161}
162
163
164int luaD_rawrunprotected(lua_State *L, Pfunc f, void *ud) {

Callers 11

errorFunction · 0.85
luaG_errormsgFunction · 0.85
luaG_traceexecFunction · 0.85
luaD_growstackFunction · 0.85
stackerrorFunction · 0.85
resume_errorFunction · 0.85
lua_yieldkFunction · 0.85
checkmodeFunction · 0.85
lexerrorFunction · 0.85
luaM_realloc_Function · 0.85
GCTMFunction · 0.85

Calls 5

seterrorobjFunction · 0.85
geterrorobjstrFunction · 0.85
notify_lua_state_stopFunction · 0.85
throw_exceptionMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected