[Ml-yokadi] IO handler (was :Re: import fix (die utils.py die die))

Sébastien Renard Sebastien.Renard
Lun 9 Fév 23:33:45 CET 2009


Le lundi 9 février 2009, Aurélien Gâteau a écrit :
> Sébastien Renard wrote:
> >> Another question: why are IOError exceptions trapped in IOStream.write?
> >> can't we let them propagate?
> >
> > We can (to purify tui from yokadi spirit). But we have to catch it in
> > onecmd() (in yokadi.py) else it will crash yokadi.
> >
> > In 0.9 the following crash yokadi with an ugly stack trace (the error
> > on "more" is to create a broken pipe):
> >
> > yokadi  | mor
> >
> > I've just commit a patch to clean up tui with your suggestions. I also
> > remove the needs of YokadiException in editText.
>
> I was just wondering why the error needed to get caught. Readable code
> is more important than purified tui :) If removing YokadiException leads
> to more complicated code, leave the code as is.
> It would be a good idea to add a comment explaining why we catch
> IOError, though :)

That was in the git commit log. Definitely not the good place for sure ;-).

I explain it and change it a little no to use tui.error(). If sterr is broken 
too it could leads to stupid things. A simple print is used now.

-- 
Sébastien


Plus d'informations sur la liste de diffusion Ml-yokadi