1Net::Twitter::Role::WraUpsEerrroCro(n3t)ributed Perl DocNuemte:n:tTawtiitotner::Role::WrapError(3)
2
3
4
6 Net::Twitter::Role::WrapError - Wraps Net::Twitter exceptions
7
9 version 4.01043
10
12 use Net::Twitter;
13
14 my $nt = Net::Twitter->new(username => $username, password => $password);
15
16 my $followers = $nt->followers;
17 if ( !followers ) {
18 warn $nt->http_message;
19 }
20
22 This module provides an alternate error handling strategy for
23 "Net::Twitter". Rather than throwing exceptions, API methods return
24 "undef" and error information is available through method calls on the
25 "Net::Twitter" object.
26
27 This is the error handling strategy used when "trait" "Legacy" is used.
28 It was the error handling strategy employed by "Net::Twitter" prior to
29 version 3.00.
30
32 new This method takes the same parameters as "new" in Net::Twitter.
33
34 get_error
35 Returns undef if there was no error or a HASH ref containing the
36 Twitter error response. Occasionally, a Twitter API call results
37 in an error with no error content returned from Twitter. When that
38 occurs, get_error returns a simulated error HASH ref.
39
40 NOTE: Versions of "Net::Twitter" prior to 3.0 sometimes returned a
41 string rather than a HASH ref, on error. This was a bug. Always
42 expect undef on success and a HASH ref on error.
43
44 http_code
45 Returns the HTTP response code the most recent API method call if
46 it ended in error.
47
48 http_message
49 Returns the HTTP message for the most recent API method call if it
50 ended in error.
51
53 Net::Twitter
54
56 Marc Mims <marc@questright.com>
57
59 Copyright (c) 2016 Marc Mims
60
61 This library is free software; you can redistribute it and/or modify it
62 under the same terms as Perl itself.
63
65 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
66 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
67 WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
68 PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
69 EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
70 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
71 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
72 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
73 NECESSARY SERVICING, REPAIR, OR CORRECTION.
74
75 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
76 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
77 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE
78 TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
79 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
80 SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
81 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
82 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
83 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
84 DAMAGES.
85
86
87
88perl v5.36.0 2023-01-20 Net::Twitter::Role::WrapError(3)