Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Unhandled exceptions checking

Reply
Thread Tools

Unhandled exceptions checking

 
 
Yosifov Pavel
Guest
Posts: n/a
 
      05-24-2008
Does somebody know existent tool for checking unhandled exceptions?
Like in Java when method throws exception but in code using this
method, try...catch is missed. May be something like PyChecker?

--
/Pavel
 
Reply With Quote
 
 
 
 
bukzor
Guest
Posts: n/a
 
      05-24-2008
On May 23, 6:31*pm, Yosifov Pavel <(E-Mail Removed)> wrote:
> Does somebody know existent tool for checking unhandled exceptions?
> Like in Java when method throws exception but in code using this
> method, try...catch is missed. May be something like PyChecker?
>
> --
> /Pavel


I know that pychecker doesn't do that. The set of handled exceptions
is probably much smaller than handled. Almost every line of code can
throw ten different exceptions (at least my code). I'm not sure what
specifically the output you'd like to see would look like.
 
Reply With Quote
 
 
 
 
David
Guest
Posts: n/a
 
      05-24-2008
On Sat, May 24, 2008 at 3:31 AM, Yosifov Pavel <(E-Mail Removed)> wrote:
> Does somebody know existent tool for checking unhandled exceptions?
> Like in Java when method throws exception but in code using this
> method, try...catch is missed. May be something like PyChecker?
>


Python is too dynamic to do this reliably. eg:

e = exception_returning_func()
raise e

You'll probably be better served by capturing and logging all
unhandled exceptions in your app ("logger.exception(e)" works nicely
in a high level "catch Exception e" block), and then notifying users.

Another thing to try is coverage testing. Won't raise all possible
exceptions in a given piece of code, but at least you can check if
all lines get run once.

David.
 
Reply With Quote
 
Yosifov Pavel
Guest
Posts: n/a
 
      05-26-2008
On 24 อมส, 12:58, bukzor <(E-Mail Removed)> wrote:
> On May 23, 6:31 pm, Yosifov Pavel <(E-Mail Removed)> wrote:
>
> > Does somebody know existent tool for checking unhandled exceptions?
> > Like in Java when method throws exception but in code using this
> > method, try...catch is missed. May be something like PyChecker?

>
> > --
> > /Pavel

>
> I know that pychecker doesn't do that. The set of handled exceptions
> is probably much smaller than handled. Almost every line of code can
> throw ten different exceptions (at least my code). I'm not sure what
> specifically the output you'd like to see would look like.


OK. I understand point of view of all responders.
It seems I surmised why it's very difficult to do in tool like
PyChecker:
not only functions/methods but usual Python expression can mask
potential
exception source. And this tool must know how to parse every
expression
deep (to object protocol methods, for example). But it's possible in
principle...
And you are right: the output of this tool will be very verbal

Thanks to all
 
Reply With Quote
 
Marc 'BlackJack' Rintsch
Guest
Posts: n/a
 
      05-26-2008
On Sun, 25 May 2008 21:00:01 -0700, Yosifov Pavel wrote:

> OK. I understand point of view of all responders.
> It seems I surmised why it's very difficult to do in tool like
> PyChecker: not only functions/methods but usual Python expression can
> mask potential exception source. And this tool must know how to parse
> every expression deep (to object protocol methods, for example). But
> it's possible in principle...


So which *specific* exceptions can be thrown by this function:

def f():
raise globals()[raw_input()]()

Ciao,
Marc 'BlackJack' Rintsch
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
an unhandled win32 exception was unhandled occurred in inetinfo.exe Warren Tang ASP .Net 1 09-23-2008 03:01 PM
How do I catch unhandled exceptions Alan Silver ASP .Net 5 03-23-2006 08:51 PM
Unhandled Exceptions thrown Winista ASP .Net 0 03-22-2006 08:02 PM
Unhandled Exceptions - ASP.Net tberry@vhb.com ASP .Net 1 03-07-2006 10:41 PM
Unhandled Exceptions & Framesets terry ASP .Net 5 07-03-2003 04:20 PM



Advertisments