<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body style=" font-family:'Sans Serif'; font-size:13pt; font-weight:400; font-style:normal;">在 星期四 07 五月 2009 19:47:41,Frédéric Mantegazza 写道:<br>
> > Is there a way to catch Python exceptions in all parts of a PyQt program?<br>
> ><br>
> > I have a "report bug" dialog box which gets called if an exception occurs<br>
> > in<br>
> > the most frequently used parts of my program, but it would be nice if I<br>
> > could catch every unhandled exception globally.<br>
> ><br>
> > The really nice thing about python is that program tends to keep running<br>
> > despite an exception in a slot, so we don't get immediate data loss.<br>
><br>
> I don't know if it is possible to catch exceptions globally, but I was<br>
> thinking of using decorators arround all my PyQt callbacks, to add a<br>
> try/except feature, and display something like your "report bug" dialog<br>
> box.<br>
><br>
> Does anybody already done such decorator?<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Maybe this way is too painful I think...</p></body></html>