<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote">2013/1/7 Maciej (Matchek) Bliziński <span dir="ltr"><<a href="mailto:maciej@opencsw.org" target="_blank">maciej@opencsw.org</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



2013/1/7 Yann Rouillard <<a href="mailto:yann@pleiades.fr.eu.org" target="_blank">yann@pleiades.fr.eu.org</a>>:<br>
<div>> I think that makes a lot of sense.<br>
><br>
> I suppose we should define some exception class whose instances would at<br>
> least contain the error message and the information message.<br>
> Any check could use this exception or a sub-class when they need to raise an<br>
> error.<br>
<br>
</div>Each module can define its exceptions; I was following this rule most<br>
of the time so far. But for simplicity, we should not change the type<br>
of exception we're raising, only display an error message and<br>
propagate the exception as-is. This way we keep the code simpler and<br>
not bury ourselves in an exception handling jungle.<br></blockquote><div><br></div><div style>You think it will be so complicated if we just use a parent class for all exceptions (or at least these kind of exceptions) ?</div>

<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>
> Now the question is just: where is the central place to catch these<br>
> exceptions and display the message ?<br>
<br>
</div>I would like to avoid having this. If anything goes wrong, I want to<br>
crash early and loud.<br></blockquote><div><br></div><div><div>I find cleaner that the function just raises exceptions and that the caller decides how to handle the message.</div><div>I find this more flexible, it allows us to easily make change to the way we handle these errors if this is done in a one place.<br>

</div><div style><br></div><div style>About the need to crash early, what is exactly the risk ? After your comment, I thought that for exemple an intermediate function might catch exceptions too broadly and prevents the exception from being properly handled. I am not sure if this is a big problem. We could easily search for this kind of exception catch.</div>

<div style><br></div><div style><div>At least, I think we should create some common function used by each module to print the error message so we keep the advantage of not duplicating the code used to display the error.<br>

</div><div><br></div></div><div style> <br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><br>
> I didn't check yet but I am sure you already have an idea.<br>
><br>
> For the stack trace, we could display it only in debug mode.<br>
<br>
</div>I'm thinking that if we don't display the stack trace, we won't be<br>
able to ask for it right away (“can you show me the stack trace?” --<br>
“what stack trace?”). Right now people can immediately copy/paste the<br>
stack trace and quickly give us idea about what's going on. Without<br>
the stack trace, we'll still have to go and ask people to re-run in<br>
debug mode, then copy and paste. Why add an additional middle step?<br></blockquote><div><br></div><div style>Well I understood that the idea was not freak people.</div><div style>I think that a stack trace can give the impression that the error was not properly handled and can prevent people from really looking at the output and see the informative message.</div>

<div style>If the stack trace is really long, you might even miss the informative message.</div><div style><br></div><div style>We can try to lay out the message so we don't miss the informative part, but we would need to generate the traceback ourself to be able to display it before the informative message. That would advocate even more to use some common code to display the error.</div>

<div style><br></div><div style><br></div><div style>Well, that's just my opinion. I am less versed in python that you are.</div><div style><br></div><div style>Yann</div><div style><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<div><div><br>
Maciej<br>
_______________________________________________<br>
maintainers mailing list<br>
<a href="mailto:maintainers@lists.opencsw.org" target="_blank">maintainers@lists.opencsw.org</a><br>
<a href="https://lists.opencsw.org/mailman/listinfo/maintainers" target="_blank">https://lists.opencsw.org/mailman/listinfo/maintainers</a><br>
.:: This mailing list's archive is public. ::.</div></div></blockquote></div><br></div></div>