BZ::Cl...ception(3pm)
π BZ::Client::Exception β the manual page, but make it make sense
okay so this is BZ::Client::Exception, and it lives in the User Contributed Perl Documentation section of your man pages (the 3pm girlies, you know the ones). this is the exception class β the one BZ::Client throws when stuff goes sideways. she's iconic, she's dramatic, she's here to tell you what broke π«Ά
β¨ VERSION β¨
version 4.91 β that's the vibe check, and she passed. π
πΈ SYNOPSIS πΈ
so here's the thing bestie: BZ::Client does not return error codes, and it does not do any of that similar stuff. that's not her brand. instead, she throws instances of BZ::Client::Exception. like literally just hurls them at you. catch them, or perish π
my $exception = BZ::Client::Exception->new( message => $message,
http_code => $httpCode,
xmlrpc_code => $xmlrpcCode );
BZ::Client::Exception->throw( message => $message,
http_code => $httpCode,
xmlrpc_code => $xmlrpcCode );
π METHODS π
π new
Creates the exception object. that's it, that's the job. she's born β¨
π₯ throw
Creates the exception object and then dies. so likeβ¦ make sure you actually catch it, bestie, or your whole program is gonna be a main character in a tragedy. π
π message
Returns the error message text. the what-went-wrong of it all.
π¦ xmlrpc_code
Returns the error code from XMLRPC. the number from the XMLRPC side of things, iykyk.
π http_code
Returns the http code (200, 404, etc.) β yes, 200 is in the list, don't come for me, that's literally what the manpage says. π
πΈ EXAMPLE πΈ
Here are two examples. The first uses Perl's inbuilt eval() function, the second uses the Try::Tiny module. Further alternatives exist and may be perfectly good options if they suit you β no gatekeeping here, we love options. π
π§ eval
use BZ::Client;
use BZ::Client::Bug::Attachment;
use v5.10;
my $client = BZ::Client->new( %etc );
eval {
my $att = BZ::Client::Bug::Attachment->get($client, { ids => 30505 });
};
if ($@) {
say 'An Error Occured';
say 'Message: ', $@->message();
say 'HTTP Code: ', $@->http_code() if $@->http_code();
say 'XMLrpc Code: ', $@->xmlrpc_code() if $@->xmlrpc_code();
};
π Try::Tiny
use BZ::Client;
use BZ::Client::Bug::Attachment;
use Try::Tiny;
use v5.10;
my $client = BZ::Client->new( %etc );
try {
my $att = BZ::Client::Bug::Attachment->get($client, { ids => 30505 });
}
catch {
say 'An Error Occured';
say 'Message: ', $_->message();
say 'HTTP Code: ', $_->http_code() if $_->http_code();
say 'XMLrpc Code: ', $_->xmlrpc_code() if $_->xmlrpc_code();
};
ngl, 'An Error Occured' is spelled exactly like that in the original and I refuse to fix it. copy-paste her as-is, she's a period piece. π
π SEE ALSO π
BZ::Client β the parent, the origin story, the one who throws her in the first place.
π AUTHORS π
- Dean Hamstead
<dean@bytefoundry.com.au> - Jochen Wiedmann
<jochen.wiedmann@gmail.com>
two legends, one exception class. we stan. π«Ά
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2026 by Dean Hamstad.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay, open source, etc. β
okay that's the whole page, no cap, nothing skipped. mwah π this was rendered for you by perl v5.40.2 on 2026-07-16 β go forth and catch your exceptions, bestie! π¦πβ¨
π¦ where this page comes from
- epel 10: perl-BZ-Client 4.9100-2.el10_3 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms