The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Opsview::REST::Exception - Structured exceptions for Opsview::REST

SYNOPSIS

    my $e = Opsview::REST::Exception->new(
        status  => 404,
        reason  => "Not Found",
        message => "The method called doesn't exist",
    );

    croak $e;

    # To inspect the exception from your code
    my $ops = Opsview::REST->new( ... );
    
    eval { $ops->get('/rest_api_method'); };
    if ($@) {
        warn $@->status;
        warn $@->reason;
        warn $@->message;
    }

DESCRIPTION

This is a convenience object to throw exceptions from within Opsview::REST modules.

ATTRIBUTES

status

reason

message

message is not guaranteed to be defined in every exception

AUTHOR

  • Miquel Ruiz <mruiz@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Miquel Ruiz.

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