JSON::...::Error(3pm)
β¨ NAME β¨
JSON::RPC::Common::Procedure::Return::Error β bestie, it's the base class for all the JSON-RPC errors π (and yeah the man page header just calls it JSON::...::Error(3pm) because man page headers are cowards who truncate, but you and me? we know her full name π)
πΈ VERSION πΈ
version 0.11 β that's the one, no cap π
π SYNOPSIS π
okay so here's the whole vibe, literally copy-paste this:
use JSON::RPC::Common::Procedure::Return::Error;
my $error = JSON::RPC::Common::Procedure::Return::Error->new(
message => "foo",
code => "bah",
);
# or construct a return with an error from a call:
my $return = $call->return_error("foo");
$return->error->message;
see how she did that? new with a message and a code, or just slide in via $call->return_error("foo") and grab $return->error->message like it's nothing π«Ά
π¦ DESCRIPTION π¦
This is a base class for all version specific error implementations. That's it. That's the whole job. She's the mother of all error classes and she is serving main character energy without even trying β¨
π ATTRIBUTES π
codemessagedata
These three are the common JSON-RPC error fields, fr fr π
In JSON-RPC 1.1, "data" is known as "error", and in 1.0 none of this is specced at all π (yes bestie, 1.0 said "no thoughts, head empty" and we respect that, but also π)
Go peep the version specific subclasses for the various behaviors, because they each do their own little thing β¨
Oh and heads up: code is an integer, and message is a string. Don't be out here passing vibes where an integer goes π
π METHODS π
new_dwimβ convenience constructor used by"return_error" in JSON::RPC::Common::Procedure::Callπ Will return an object if that's the argument, and otherwise construct an error. Like, she reads the room. If you hand her an object she gives it right back, if you hand her anything else she makes you a fresh error. Versatile queen πinflateβ create an error object from JSON data (not text) π¦ In order to maximize compatibility this inflation routine is very liberal in what it accepts β she is not picky, she says yes to almost everything, she's the friendliest bouncer you've ever met π
π AUTHOR π
Yuval Kogman <nothingmuch@woobling.org> β legend behavior, honestly π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2014 by Yuval Kogman and others π
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Slay, open source, we love to see it πΈ
okay bestie that's the whole page, you're so ready π go forth and error correctly β¨
perl v5.30.3 Β· 2020-06-23 Β· and that's the <pink>JSON::...::Error(3pm)</pink> sign-off, mwah ππ«Άπ
π¦ where this page comes from
- debian bookworm: libjson-rpc-common-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libjson-rpc-common-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libjson-rpc-common-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libjson-rpc-common-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libjson-rpc-common-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libjson-rpc-common-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms