MUD Game Programming By Ron Penton

Started by
16 comments, last by odious 19 years, 11 months ago
See if this catch block works:

catch (std::exception &e){  // Prints any pending python exception with traceback  // Might not do anything useful if SWIG already processed it.  // Output goes to standard error, so you'll probably need to  // have the server running in a console window - I doubt the  // error will be reflected over telnet. We could mess with  // redirection but that's non-trivial, and doesn't provide  // that big of a benefit here.  if(PyErr_Occured()) PyErr_Print();   // Assuming the exception derived from the standard C++ base  // exception class std::exception, and that it has been  // properly constructed, we try and report the exception data.  c.DoAction( "error", 0, 0, 0, 0, e.what() );  return;}


You may need to include stdexcept to get the definition for std::exception and Python.h for the python stuff. I just hope Ron or the Python folks derived their exceptions from std::exception...

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” — Brian W. Kernighan

[edited by - Fruny on May 19, 2004 10:42:27 AM]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Advertisement
quote:Original post by odious
btw you mentioned you left the book, so im assuming you have indeed played with this code base. Did you not experience the same issue in that case?


No, I didn''t actually play with the code base, but I did argue quite a bit with Ron about its design while he was writing the book. So, yeah, I''m not as helpful as I could be, but at least I know a bit about it.

Right now I''m at a public terminal in a library, so there''s not much I can do with your own files, sorry. Plus I need to go back to my room and continue packing out before the university kicks me out.

I''ll be back this afternoon.

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” — Brian W. Kernighan
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
which header has that function "PyErr_occured()" and everything in it, It is undefined right now when I compile
Heh, well i hope i dont hold you up, this wouldnt be a problem i bet if Ron would update his site for once since the last update took place only a month after his book released. Its very hard to find any after publication help.
I have python.h included but it doesnt seem to hold the define for the functions you listed
Typo, should have been PyErr_Occured.

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” — Brian W. Kernighan
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
well the Doaction sent telnet this
Unknown exception
YAY hehe i was really hoping for something more to be there as to better help this along. Does this mean it was not a python error then?
Right now I don''t know. Try pestering Ron in #gamedev on irc.afternet.org (or click ''GDNet Chat Network'' at the top of the page).

I''m off, see you later (maybe in IRC or in ICQ/AIM).

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” — Brian W. Kernighan
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

This topic is closed to new replies.

Advertisement