Consistent Lua script error and print() output 1/2
This commit is contained in:
parent
a4cfdd338d
commit
a2f07f66a5
|
@ -192,8 +192,10 @@ LuaProc::route () const
|
|||
|
||||
void
|
||||
LuaProc::lua_print (std::string s) {
|
||||
std::cout <<"LuaProc: " << s << "\n";
|
||||
PBD::error << "LuaProc: " << s << "\n";
|
||||
#ifndef NDEBUG
|
||||
std::cout << "LuaProc: " << s << "\n";
|
||||
#endif
|
||||
PBD::info << "LuaProc: " << s << "\n";
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -258,6 +260,10 @@ LuaProc::load_script ()
|
|||
try {
|
||||
lua_dsp_init (_session.nominal_sample_rate ());
|
||||
} catch (luabridge::LuaException const& e) {
|
||||
#ifndef NDEBUG
|
||||
std::cerr << "LuaException:" << e.what () << std::endl;
|
||||
#endif
|
||||
PBD::warning << "LuaException: " << e.what () << endmsg;
|
||||
return true; // error
|
||||
} catch (...) {
|
||||
return true;
|
||||
|
@ -605,10 +611,10 @@ LuaProc::configure_io (ChanCount in, ChanCount out)
|
|||
}
|
||||
_configured = true;
|
||||
} catch (luabridge::LuaException const& e) {
|
||||
PBD::error << "LuaException: " << e.what () << "\n";
|
||||
#ifndef NDEBUG
|
||||
std::cerr << "LuaException: " << e.what () << "\n";
|
||||
#endif
|
||||
PBD::warning << "LuaException: " << e.what () << "\n";
|
||||
return false;
|
||||
} catch (...) {
|
||||
return false;
|
||||
|
@ -756,10 +762,10 @@ LuaProc::connect_and_run (BufferSet& bufs,
|
|||
}
|
||||
|
||||
} catch (luabridge::LuaException const& e) {
|
||||
PBD::error << "LuaException: " << e.what () << "\n";
|
||||
#ifndef NDEBUG
|
||||
std::cerr << "LuaException: " << e.what () << "\n";
|
||||
#endif
|
||||
PBD::warning << "LuaException: " << e.what () << "\n";
|
||||
return -1;
|
||||
} catch (...) {
|
||||
return -1;
|
||||
|
|
|
@ -220,12 +220,20 @@ LuaScripting::scan_script (const std::string &fn, const std::string &sc)
|
|||
#endif
|
||||
return LuaScriptInfoPtr();
|
||||
}
|
||||
} catch (...) { // luabridge::LuaException
|
||||
} catch (luabridge::LuaException const& e) {
|
||||
#ifndef NDEBUG
|
||||
cerr << "failed to parse lua script\n";
|
||||
cerr << "Exception: Failed to parse lua script fn: '"<< fn << "' " << e.what () << "\n";
|
||||
#endif
|
||||
PBD::warning << "Exception: Failed to parse lua script fn: '"<< fn << "' " << e.what () << "\n";
|
||||
return LuaScriptInfoPtr();
|
||||
} catch (...) {
|
||||
#ifndef NDEBUG
|
||||
cerr << "Exception: Failed to parse lua script fn: '"<< fn << "'\n";
|
||||
#endif
|
||||
PBD::warning << "Exception: Failed to parse lua script fn: '"<< fn << "'\n";
|
||||
return LuaScriptInfoPtr();
|
||||
}
|
||||
|
||||
luabridge::LuaRef nfo = luabridge::getGlobal (L, "ardourluainfo");
|
||||
if (nfo.type() != LUA_TTABLE) {
|
||||
#ifndef NDEBUG
|
||||
|
|
|
@ -5103,11 +5103,12 @@ Session::registered_lua_functions ()
|
|||
return rv;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
static void _lua_print (std::string s) {
|
||||
std::cout << "SessionLua: " << s << "\n";
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
std::cout << "LuaSession: " << s << "\n";
|
||||
#endif
|
||||
PBD::info << "LuaSession: " << s << endmsg;
|
||||
}
|
||||
|
||||
void
|
||||
Session::try_run_lua (pframes_t nframes)
|
||||
|
@ -5123,9 +5124,7 @@ Session::try_run_lua (pframes_t nframes)
|
|||
void
|
||||
Session::setup_lua ()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
lua.Print.connect (&_lua_print);
|
||||
#endif
|
||||
lua.sandbox (true);
|
||||
lua.do_command (
|
||||
"function ArdourSession ()"
|
||||
|
|
|
@ -1782,7 +1782,10 @@ Session::set_state (const XMLNode& node, int version)
|
|||
Glib::Threads::Mutex::Lock lm (lua_lock);
|
||||
(*_lua_load)(std::string ((const char*)buf, size));
|
||||
} catch (luabridge::LuaException const& e) {
|
||||
#ifndef NDEBUG
|
||||
cerr << "LuaException:" << e.what () << endl;
|
||||
#endif
|
||||
warning << "LuaException: " << e.what () << endmsg;
|
||||
} catch (...) { }
|
||||
g_free (buf);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user