mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-02 05:30:23 +02:00
Enhancement - hooks
- Improved diagnostics of C++ side of the Lua API.
This commit is contained in:
parent
e3c28f3fb3
commit
8540cab0a6
1 changed files with 4 additions and 3 deletions
|
@ -491,10 +491,11 @@ bool API::callProgramHook (
|
||||||
throw std::string ("Error calling '") + function + "' - " + lua_tostring (L, -1);
|
throw std::string ("Error calling '") + function + "' - " + lua_tostring (L, -1);
|
||||||
|
|
||||||
// Call successful - get return values.
|
// Call successful - get return values.
|
||||||
if (!lua_isnumber (L, -2)) throw std::string ("Error: '") + function + "' did not return a success indicator";
|
if (!lua_isnumber (L, -2))
|
||||||
|
throw std::string ("Error: '") + function + "' did not return a success indicator";
|
||||||
|
|
||||||
// TODO This doesn't seem to know that 'nil' was returned instead of a string.
|
if (!lua_isstring (L, -1) && !lua_isnil (L, -1))
|
||||||
// if (!lua_isstring (L, -1)) throw std::string ("Error: '") + function + "' did not return a message";
|
throw std::string ("Error: '") + function + "' did not return a message or nil";
|
||||||
|
|
||||||
int rc = lua_tointeger (L, -2);
|
int rc = lua_tointeger (L, -2);
|
||||||
const char* message = lua_tostring (L, -1);
|
const char* message = lua_tostring (L, -1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue