[Tutor] Uncertain about exceptions

Kent Johnson kent37 at tds.net
Wed Jul 6 14:27:07 CEST 2005

Matej Cepl wrote:
> Now, my question is concerned with the use of exception in SoupReader.suck.
> The idea is that when the page is not available for download, whole object
> goes up in flames, the rest of SoapReader.__init__ is skipped over, and the
> exception is then caught in reprocess.py cycle, which makes a note in some
> errorlog, that this particular page has not been downloaded, but otherwise
> the script continues for other pages. Is it what I am doing here or did I
> missed the idea of exceptions at all?

After a quick look I think you have it right. You could define PageNotAvailable as
class PageNotAvailable(Exception):

because the behavior you give it is the default behaviour for Exception.


More information about the Tutor mailing list