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

NAME

Gerrit::REST::Exception - Exception class for Gerrit::REST errors

VERSION

version 0.009

DESCRIPTION

This is an auxiliary class for the Gerrit::REST distribution. It's used by Gerrit::REST methods to throw exceptions when they get some error code from Gerrit itself, during a REST call. The Gerrit::REST::Exception objects are simple hash-refs containing the following information taken from the REST HTTP response:

  • code

    The HTTP numeric error code.

  • type

    The HTTP Content-Type.

  • content

    The HTTP response contents.

Read Gerrit::REST documentation to know how to use it.

SYNOPISIS

    use Gerrit::REST::Exception;

    # ...
    die Gerrit::REST::Exception->new($code, $content_type, $content);

METHODS

new CONTENT

If the constructor receives one argument it must be a string content. In this case, the code is assumed to be 500 and the type to be text/plain.

new CODE, TYPE, CONTENT

If the constructor receives three arguments they are: the code, the Content-Type, and the content of the REST HTTP error message.

as_text

This method stringifies the object like this:

    Gerrit::REST::Exception[<code>]: <content>

The contents are converted to text if possible.

AUTHOR

Gustavo L. de M. Chaves <gnustavo@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by CPqD <www.cpqd.com.br>.

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