| JSON-RPC-Common documentation | Contained in the JSON-RPC-Common distribution. |
JSON::RPC::Common::Procedure::Return::Version_2_0::Error - JSON-RPC 2.0 error class.
version 0.10
my $return_with_error = $call->return_error("foo");
This class implements 2.0 error objects.
code and message are mandatory.
Yuval Kogman <nothingmuch@woobling.org>
This software is copyright (c) 2011 by Yuval Kogman.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
| JSON-RPC-Common documentation | Contained in the JSON-RPC-Common distribution. |
#!/usr/bin/perl package JSON::RPC::Common::Procedure::Return::Version_2_0::Error; BEGIN { $JSON::RPC::Common::Procedure::Return::Version_2_0::Error::VERSION = '0.10'; } use Moose; # ABSTRACT: JSON-RPC 2.0 error class. use JSON::RPC::Common::TypeConstraints qw(JSONValue); use namespace::clean -except => [qw(meta)]; extends qw(JSON::RPC::Common::Procedure::Return::Error); has '+message' => ( required => 1, ); has '+code' => ( default => -32603, ); sub deflate { my $self = shift; return { code => $self->code, message => $self->message, ( $self->has_data ? ( data => $self->data ) : () ), }; } __PACKAGE__->meta->make_immutable; __PACKAGE__ __END__