HTTP::Throwable::JSONFactory - Throw exceptions with JSON bodies
version 0.002
use HTTP::Throwable::JSONFactory qw(http_throw); http_throw(Gone => { payload => { error => "You won't find what you're looking for here", }, });
This subclass of HTTP::Throwable::Factory arranges for each built/thrown exception to consume the HTTP::Throwable::Role::JSONBody role, which will generate HTTP responses with an application/json content type and encode the (optional) provided payload using JSON::MaybeXS.
application/json
The payload attribute passed to http_throw or http_exception should be anything allowed by "encode_json" in JSON (hashref, arrayref, etc).
payload
http_throw
http_exception
Matthew Horsfall <wolfsage@gmail.com>
This software is copyright (c) 2016 by Matthew Horsfall.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install HTTP::Throwable::JSONFactory, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTTP::Throwable::JSONFactory
CPAN shell
perl -MCPAN -e shell install HTTP::Throwable::JSONFactory
For more information on module installation, please visit the detailed CPAN module installation guide.