Net::T...apError(3pm)

πŸ“¦
version 4.01043 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble

πŸ’– Net::Twitter::Role::WrapError(3pm) β€” bestie edition πŸ’–

okay so real quick: this is the Net::Twitter::Role::WrapError page from the User Contributed Perl Documentation, and the header up top is being all dramatic and truncated, showing up as Net::T...apError(3pm) like it's too iconic for a full name. we know the truth tho 🫢


✨ NAME ✨

Net::Twitter::Role::WrapError β€” it wraps Net::Twitter exceptions 🌈 like a lil protective blanket for your error handling


πŸŽ€ VERSION πŸŽ€

version 4.01043 πŸ’…


🌸 SYNOPSIS 🌸

here's the vibe, copy-paste coded exactly as-is:

use Net::Twitter;

my $nt = Net::Twitter->new(username => $username, password => $password);

my $followers = $nt->followers;
if ( !followers ) {
    warn $nt->http_message;
}

see how we're checking !followers instead of catching a throw? that's the whole personality of this module. no cap ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so this module gives Net::Twitter an alternate error handling strategy, bestie. instead of throwing exceptions all over the place (so messy 😭), the API methods just return undef, and all the error tea is available through method calls on the Net::Twitter object. it's giving "quietly hands you the receipts instead of screaming in the group chat" πŸ’…

this is the error handling strategy you get when the trait Legacy is used. and fun fact: it was literally the error handling strategy Net::Twitter employed prior to version 3.00 β€” so yeah, it's the OG, the blueprint, the moment before the glow-up πŸ‘‘


πŸ’œ METHODS πŸ’œ

  • new β€” this method takes the same parameters as new in Net::Twitter. same energy, same args, no surprises 🫢
  • get_error β€” returns undef if there was no error, or a HASH ref containing the Twitter error response. and here's a lil edge case for you: occasionally a Twitter API call results in an error with no error content returned from Twitter. when that happens? get_error returns a simulated error HASH ref. it's making one up. it's improvising. iconic behavior honestly 🎭
NOTE: versions of Net::Twitter prior to 3.0 sometimes returned a string rather than a HASH ref, on error. this was a bug. always expect undef on success and a HASH ref on error. periodt πŸ’€
  • http_code β€” returns the HTTP response code of the most recent API method call, if it ended in error. (if it didn't end in error... nothing, bestie, it's just vibes) πŸ“Ÿ
  • http_message β€” returns the HTTP message for the most recent API method call if it ended in error. this is the one your warn call wants πŸ—£οΈ

🌈 SEE ALSO 🌈

  • Net::Twitter

πŸ‘‘ AUTHOR πŸ‘‘

Marc Mims <marc@questright.com> β€” thank you for your service, king 🫑


πŸ’– LICENSE πŸ’–

Copyright (c) 2016 Marc Mims

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. πŸ“


πŸ™ˆ DISCLAIMER OF WARRANTY πŸ™ˆ

okay bestie, this is the part where we get real serious, so buckle up. i'm keeping every single word's worth of meaning here, because this is legally binding and not the vibe to paraphrase:

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.


and that's the whole page, bestie!! πŸŽ€ mwah πŸ’‹ this lil beauty ships as perl v5.34.0, dated 2022-06-16 β€” go forth and wrap those errors, i'm obsessed with you πŸ’œβœ¨

πŸ“¦ where this page comes from