Re: weblogsping.py error handling patch
will guaraldi <[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
I'm not sure wrapping callbacks in try/except blocks would make plugin design more robust. Say you wrapped the run_callback in one try/except block. If a plugin throws an exception and the callback ends, we don't have a lot of confidence that PyBlosxom is in a good state to keep going. Say you wrapped each cb_ function call in a callback list in a try/except block. First off, you're incurring a performance decrease because try/except blocks are somewhat expensive. Second, if a function call fails, what state is the system in? Did the function call do some stuff that didn't get cleaned up? File locks, database sessions, data files, cached state, ... I think it's better to fail immediately rather than try to pick up broken pieces and try to make sense of them. Programmatically it's much easier to fail immediately and it's easeir to figure out what went wrong and debug it, too. Where PyBlosxom is a blogging script, I'm inclined to keep it simple and fail immediately rather than build infrastructure to run correctly regardless of errors. On another note, where'd you get that email address for Wari? /will On Tue, 29 Aug 2006, Ryan Barrett wrote: > > on second thought, it might be more appropriate to put this kind of > error handling in the core. pyblosxom would wrap all of its calls to > plugin callbacks in try/except blocks, and log the exceptions, instead > of letting them propagate all the way up. this would make the plugin > design more robust. > > wari's email address is bouncing, so pyblosxom-devel...thoughts? > > > On Tue, 29 Aug 2006, Ryan Barrett wrote: > >> hi wari, pyblosxom-devel. i've attached a small patch for >> weblogsping.py, against the version in the 1.3 contrib pack. >> >> right now, if it can't connect to weblogs.com or ping.blo.gs, or gets a >> 5xx HTTP response code, or hits an XML-RPC fault, it lets the exception >> propagate up to pyblosxom. pyblosxom then dies and shows the user an >> ugly error message. >> >> this patch handles the exception, logs an error, and lets pyblosxom >> continue rendering the page. >> >> -Ryan >> >> p.s. i'll start submitting patches against svn, instead of 1.3, Real >> Soon Now. promise! :P ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642