Re: error exceptions
Jason McKesson <[email protected]> Tue, 09 Aug 2011 11:53:19 -0700
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
On Aug 09, 2011 7:17 AM, Josh Stratton wrote:
> I'm trying to get error messages to display and I was following this
> tutorial. However, I can't seem to get any error exceptions. In a
> lua script I'm running, I have a print at the top and bottom and it's
> only hitting the top one, so I'm assuming there is some error in there
> I thought should raise an exception.
>
> http://www.nuclex.org/articles/5-cxx/1-quick-introduction-to-luabind
>
> void loadLuaFile(lua_State* state, QString fileName)
> {
> QFile file(fileName);
> file.open(QIODevice::ReadOnly);
> QString lines = file.readAll();
> //std://:cout<< lines.toStdString()<< std::endl;
> try {
> std::cout<< "executing "<< fileName.toStdString()<<
> "...\n-----------"<< std::endl;
> std::cout<< lines.toStdString().c_str()<< std::endl;
> luaL_dostring(state, lines.toStdString().c_str());
> } catch (const std::exception&TheError) {
> std::cout<< "*"<< std::endl;
> std::cout<< TheError.what()<< std::endl;
> }
>
> file.close();
> }
>
> ------------------------------------------------------------------------------
> uberSVN's rich system and user administration capabilities and model
> configuration take the hassle out of deploying and managing Subversion and
> the tools developers use with it. Learn more about uberSVN and get a free
> download at: http://p.sf.net/sfu/wandisco-dev2dev
> _______________________________________________
> luabind-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>
Luabind only throws exceptions if you call into Lua code *through*
Luabind. You're calling Lua code through the standard Lua API, therefore
no exceptions will be thrown. Instead, the typical Lua error handling
code will be used.
------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model
configuration take the hassle out of deploying and managing Subversion and
the tools developers use with it. Learn more about uberSVN and get a free
download at: http://p.sf.net/sfu/wandisco-dev2dev