BZ::Cl...ception(3pm)

πŸ“¦
version 4.9100 Β· 4 versions
, in epel 10

πŸ’… 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. 🫢


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