panna: (Default)
panna ([personal profile] panna) wrote in [site community profile] dw_dev2010-07-28 09:24
Entry tags:

Testing exceptions

Hi:) I'm a one working on a calendar functionality for Dreamwidth:)

I'd like to ask what to use to test if my code threw exception. I found that this could be tested by Test::Exeption library's commands, but there is no Test/ library in Dreamwidth's CPAN.

I found that Dw do use exceptions, but maybe there is preferred to return a specific code? (I prefer throwing exceptions...:P)
alierak: (Default)

[personal profile] alierak 2010-07-28 18:19 (UTC)(link)
It's Perl, so "there's more than one way to do it". You'll find some of our code just returning undef when it fails, caller beware. Some things use objects to represent different types of exceptions (see cgi-bin/LJ/ Some code will just die if it fails, so you have to wrap it in an eval { } block. And so on.
sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)

[personal profile] sophie 2010-07-29 14:21 (UTC)(link)
By the way, what do you mean by "Dreamwidth's CPAN"?