NAME

WebService::Bugzilla::Exception - Exception class for WebService::Bugzilla HTTP errors

VERSION

version 0.001

SYNOPSIS

use WebService::Bugzilla::Exception;

WebService::Bugzilla::Exception->throw(
    message     => 'Bug not found',
    http_status => 404,
);

# or catch one thrown by the client
eval { $bz->bug->get(999999) };
if (my $e = $@) {
    say $e;               # stringifies via overloaded ""
    say $e->http_status;  # 404
}

DESCRIPTION

Exception objects thrown by WebService::Bugzilla for HTTP or Bugzilla-level errors. The class overloads stringification so exceptions can be printed directly. Attributes carry the HTTP status and optional Bugzilla error code for programmatic handling.

ATTRIBUTES

All attributes are read-only.

bz_code

Bugzilla-specific numeric error code, when the server provides one.

http_status

HTTP status code returned by the server.

message

Required. Human-readable error message.

METHODS

as_string

say $exception->as_string;
say "$exception";          # same, via overloaded ""

Return a human-readable string combining message, bz_code, and http_status.

throw

WebService::Bugzilla::Exception->throw(message => 'oops');

Class method. Construct an exception and immediately die with it.

SEE ALSO

WebService::Bugzilla - main client that throws these exceptions

AUTHOR

Dean Hamstead <dean@fragfest.com.au>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2026 by Dean Hamstead.

This is free software, licensed under:

The MIT (X11) License