Group
Extension

Matches 1

JSON-API-Error ( K/KW/KWAKWA/JSON-API-Error-0.01.tar.gz, KWAKWA, 2018; MetaCPAN )
JSON-API-Error/lib/JSON/API/Error.pm ( view source; MetaCPAN )
package JSON::API::Error;

# ABSTRACT: JSON API-style error objects

use Moo;
use overload bool => sub {1}, '""' => \&to_string;

use Types::Standard qw/Str HashRef/;

our $VERSION = '0.01';

has code

}

sub TO_JSON {
    my $self = shift;
    my $json = {};
    for (qw/code detail id links meta source status title/) {
        $json->{$_} = $self->$_ if $self->$_;
    }
    return $json;
}

1;

__
E

JSON::API::Error - JSON API-style error objects

=head1 SYNOPSIS

  use JSON::API::Error;
  use Mojo::JSON qw/encode_json/;

  # A JSON API error representing bad submission data
  my $err = JSON::

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.