Net::T...::Error(3pm)
π NAME π
ok so bestie, <pink>Net::Twitter::Lite::Error</pink> β it's the little β¨vesselβ¨ that holds onto all the errors that <purple>Net::Twitter::Lite</purple> yeets at you. Like, when the vibes go wrong, this is the object that catches them. π«Ά
π VERSION π
this is <cyan>version 0.12008</cyan>, no cap π
πΈ SYNOPSIS πΈ
ok here's the whole vibe in four lines, slay:
use Net::Twitter::Lite;
my $nt = Net::Twitter::Lite->new;
my $r = eval { $nt->friends_timeline };
warn "$@\n" if $@;
like, you wrap the call in eval, and if something goes sideways, $@ is holding the <pink>Net::Twitter::Lite::Error</pink> object. iconic behavior honestly. π
π¦ DESCRIPTION π¦
<pink>Net::Twitter::Lite::Error</pink> is literally the container for every error that <purple>Net::Twitter::Lite</purple> decides to throw. π«
and when one of these objects shows up, it's packing an HTTP::Response, plus a HASHREF stuffed with Twitter API error info β but only if Twitter actually sent one back. so sometimes it's full, sometimes it's just the response. vibe check dependent. β¨
π METHODS π
newβ builds you a fresh<pink>Net::Twitter::Lite::Error</pink>object. you hand it anHTTP::Response, and optionally a Twitter errorHASHref. it takes aHASHof arguments, so no positional nonsense. examples, look:
my $e = Net::Twitter::Lite::Error->new(http_response => $res, twitter_error => $te);
my $e = Net::Twitter::Lite::Error->new(http_response => $res);
see how the second one skips twitter_error? yeah, it's optional, she's flexible π
twitter_errorβ get or set the encapsulated Twitter API errorHASHref. that's it, that's the whole job. πhttp_responseβ get or set the encapsulatedHTTP::Responseinstance. same energy. π§codeβ returns the HTTP Status Code from the encapsulatedHTTP::Response. the number, the digits, the β¨receiptsβ¨messageβ returns the HTTP Status Message from the encapsulatedHTTP::Response. the words that go with the number. π¬errorβ okay this one's the main character. returns an error message as a string. here's the priority order, bestie:- if there's an
errorelement in the encapsulated Twitter APIHASHref, that's what you get π - otherwise, it returns a string containing the HTTP Status Code and Message
- and if the
<pink>Net::Twitter::Lite::Error</pink>instance has neither anHTTP::Responsenor a Twitter ErrorHASHref, or if theHTTP::Responsehas no status code or message β thenerrorreturns the string'[unknown]'. yeah. mystery era. π΅οΈ
- if there's an
oh and also? a Net::Twitter::Lite::Error stringifies to the error message. so if you just drop it into a string, that's what comes out. no conversion arc needed. π
π SEE ALSO π
Net::Twitter::Lite β the parent of all this drama. go read that one too fr fr π«Ά
β¨ AUTHOR β¨
Marc Mims <marc@questright.com> β shoutout to the legend, we love to see it π
π LICENSE π
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. slay, open source rights π
ok that's the whole page, we ate and left no crumbs π½οΈβ¨ this was <cyan>perl v5.34.0</cyan> documenting things as of <cyan>2022-06-16</cyan> β ty for coming to my ted talk, ily, go catch your errors bestie ππ¦πΈ
π¦ where this page comes from
- debian bookworm: libnet-twitter-lite-perl 0.12008-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libnet-twitter-lite-perl 0.12008-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libnet-twitter-lite-perl 0.12008-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libnet-twitter-lite-perl 0.12008-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnet-twitter-lite-perl 0.12008-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