| 127 | |
| 128 | |
| 129 | void 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 | |
| 164 | int luaD_rawrunprotected(lua_State *L, Pfunc f, void *ud) { |
no test coverage detected