diff options
Diffstat (limited to 'src/lane.cpp')
-rw-r--r-- | src/lane.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lane.cpp b/src/lane.cpp index 5904266..4b6500a 100644 --- a/src/lane.cpp +++ b/src/lane.cpp | |||
@@ -165,7 +165,7 @@ static LUAG_FUNC(thread_join) | |||
165 | break; | 165 | break; |
166 | 166 | ||
167 | default: | 167 | default: |
168 | DEBUGSPEW_CODE(fprintf(stderr, "Status: %d\n", _lane->status)); | 168 | DEBUGSPEW_CODE(DebugSpew(nullptr) << "Unknown Lane status: " << static_cast<int>(_lane->status) << std::endl); |
169 | LUA_ASSERT(L_, false); | 169 | LUA_ASSERT(L_, false); |
170 | _ret = 0; | 170 | _ret = 0; |
171 | } | 171 | } |
@@ -278,7 +278,7 @@ static int thread_index_number(lua_State* L_) | |||
278 | lua_replace(L_, -3); // L_: lane n error() "error" | 278 | lua_replace(L_, -3); // L_: lane n error() "error" |
279 | lua_pushinteger(L_, 3); // L_: lane n error() "error" 3 | 279 | lua_pushinteger(L_, 3); // L_: lane n error() "error" 3 |
280 | lua_call(L_, 2, 0); // error(tostring(errstring), 3) -> doesn't return // L_: lane n | 280 | lua_call(L_, 2, 0); // error(tostring(errstring), 3) -> doesn't return // L_: lane n |
281 | raise_luaL_error(L_, "%s: should not get here!", _lane->debugName.data()); | 281 | raise_luaL_error(L_, STRINGVIEW_FMT ": should not get here!", _lane->debugName.size(), _lane->debugName.data()); |
282 | } else { | 282 | } else { |
283 | lua_pop(L_, 1); // L_: lane n {uv} | 283 | lua_pop(L_, 1); // L_: lane n {uv} |
284 | } | 284 | } |
@@ -316,7 +316,7 @@ static int thread_index_string(lua_State* L_) | |||
316 | lua_rawget(L_, -2); // L_: mt value | 316 | lua_rawget(L_, -2); // L_: mt value |
317 | // only "cancel" and "join" are registered as functions, any other string will raise an error | 317 | // only "cancel" and "join" are registered as functions, any other string will raise an error |
318 | if (!lua_iscfunction(L_, -1)) { | 318 | if (!lua_iscfunction(L_, -1)) { |
319 | raise_luaL_error(L_, "can't index a lane with '%s'", _keystr.data()); | 319 | raise_luaL_error(L_, "can't index a lane with '" STRINGVIEW_FMT "'", _keystr.size(), _keystr.data()); |
320 | } | 320 | } |
321 | return 1; | 321 | return 1; |
322 | } | 322 | } |
@@ -345,7 +345,7 @@ static LUAG_FUNC(thread_index) | |||
345 | lua_pushvalue(L_, kKey); // L_: mt error "Unknown key: " k | 345 | lua_pushvalue(L_, kKey); // L_: mt error "Unknown key: " k |
346 | lua_concat(L_, 2); // L_: mt error "Unknown key: <k>" | 346 | lua_concat(L_, 2); // L_: mt error "Unknown key: <k>" |
347 | lua_call(L_, 1, 0); // error( "Unknown key: " .. key) -> doesn't return // L_: mt | 347 | lua_call(L_, 1, 0); // error( "Unknown key: " .. key) -> doesn't return // L_: mt |
348 | raise_luaL_error(L_, "%s[%s]: should not get here!", _lane->debugName.data(), lua_typename(L_, lua_type(L_, kKey))); | 348 | raise_luaL_error(L_, STRINGVIEW_FMT "[%s]: should not get here!", _lane->debugName.size(), _lane->debugName.data(), lua_typename(L_, lua_type(L_, kKey))); |
349 | } | 349 | } |
350 | } | 350 | } |
351 | 351 | ||
@@ -677,11 +677,11 @@ static void lane_main(Lane* lane_) | |||
677 | // in case of error and if it exists, fetch stack trace from registry and push it | 677 | // in case of error and if it exists, fetch stack trace from registry and push it |
678 | push_stack_trace(_L, lane_->errorTraceLevel, _rc, 1); // L: retvals|error [trace] | 678 | push_stack_trace(_L, lane_->errorTraceLevel, _rc, 1); // L: retvals|error [trace] |
679 | 679 | ||
680 | DEBUGSPEW_CODE(fprintf(stderr, INDENT_BEGIN "Lane %p body: %s (%s)\n" INDENT_END(_U), _L, get_errcode_name(_rc), kCancelError.equals(_L, 1) ? "cancelled" : lua_typename(_L, lua_type(_L, 1)))); | 680 | DEBUGSPEW_CODE(DebugSpew(_U) << "Lane " << _L << " body: " << get_errcode_name(_rc) << " (" << (kCancelError.equals(_L, 1) ? "cancelled" : lua_typename(_L, lua_type(_L, 1))) << ")" << std::endl); |
681 | // Call finalizers, if the script has set them up. | 681 | // Call finalizers, if the script has set them up. |
682 | // | 682 | // |
683 | LuaError const _rc2{ run_finalizers(_L, lane_->errorTraceLevel, _rc) }; | 683 | LuaError const _rc2{ run_finalizers(_L, lane_->errorTraceLevel, _rc) }; |
684 | DEBUGSPEW_CODE(fprintf(stderr, INDENT_BEGIN "Lane %p finalizer: %s\n" INDENT_END(_U), _L, get_errcode_name(_rc2))); | 684 | DEBUGSPEW_CODE(DebugSpew(_U) << "Lane " << _L << " finalizer: " << get_errcode_name(_rc2) << std::endl); |
685 | if (_rc2 != LuaError::OK) { // Error within a finalizer! | 685 | if (_rc2 != LuaError::OK) { // Error within a finalizer! |
686 | // the finalizer generated an error, and left its own error message [and stack trace] on the stack | 686 | // the finalizer generated an error, and left its own error message [and stack trace] on the stack |
687 | _rc = _rc2; // we're overruling the earlier script error or normal return | 687 | _rc = _rc2; // we're overruling the earlier script error or normal return |
@@ -839,7 +839,7 @@ void Lane::changeDebugName(int nameIdx_) | |||
839 | (errorTraceLevel == ErrorTraceLevel::Minimal) ? "minimal" : | 839 | (errorTraceLevel == ErrorTraceLevel::Minimal) ? "minimal" : |
840 | (errorTraceLevel == ErrorTraceLevel::Basic) ? "basic" : | 840 | (errorTraceLevel == ErrorTraceLevel::Basic) ? "basic" : |
841 | (errorTraceLevel == ErrorTraceLevel::Extended) ? "extended" : | 841 | (errorTraceLevel == ErrorTraceLevel::Extended) ? "extended" : |
842 | nullptr | 842 | "" |
843 | }; | 843 | }; |
844 | return _str; | 844 | return _str; |
845 | } | 845 | } |