NAME

WWW::Zitadel::Error - Structured exception classes for WWW::Zitadel

VERSION

version 0.001

SYNOPSIS

use WWW::Zitadel::Management;
use WWW::Zitadel::Error;

eval { $mgmt->get_user($id) };
if (my $err = $@) {
    if (ref $err && $err->isa('WWW::Zitadel::Error::API')) {
        warn "API error (HTTP " . $err->http_status . "): " . $err->message;
    }
    elsif (ref $err && $err->isa('WWW::Zitadel::Error::Validation')) {
        warn "Bad call: " . $err->message;
    }
    else {
        die $err;
    }
}

DESCRIPTION

Three exception classes, all inheriting from WWW::Zitadel::Error:

WWW::Zitadel::Error::Validation

Thrown when a required argument is missing or invalid (empty issuer, missing user_id, etc.).

WWW::Zitadel::Error::Network

Thrown when a discovery, JWKS, or other HTTP fetch fails at the transport level (connection refused, timeout, non-success response on OIDC endpoints).

WWW::Zitadel::Error::API

Thrown when the Management API returns a non-2xx response. Carries http_status (the status line string) and api_message (the message field from the JSON error body, if any).

All classes overload stringification to return message, so existing code that inspects $@ as a plain string continues to work without modification.

message

Human-readable error description. The object stringifies to this value, so existing eval/$@ patterns that match on the error string continue to work unchanged.

http_status

The HTTP status line returned by the server, e.g. "400 Bad Request".

api_message

The message field from the JSON error body returned by the API, if present.

SEE ALSO

WWW::Zitadel, WWW::Zitadel::OIDC, WWW::Zitadel::Management

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-zitadel/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.