1Net::Twitter::Error(3)User Contributed Perl DocumentationNet::Twitter::Error(3)
2
3
4

NAME

6       Net::Twitter::Error - A Net::Twitter exception object
7

VERSION

9       version 4.01043
10

SYNOPSIS

12           use Scalar::Util qw/blessed/;
13           use Try::Tiny;
14
15           my $nt = Net::Twitter->new(@options);
16
17           my $followers = try {
18               $nt->followers;
19           }
20           catch {
21               die $_ unless blessed($_) && $_->isa('Net::Twitter::Error');
22
23               warn "HTTP Response Code: ", $_->code, "\n",
24                    "HTTP Message......: ", $_->message, "\n",
25                    "Twitter error.....: ", $_->error, "\n",
26                    "Stack Trace.......: ", $_->stack_trace->as_string, "\n";
27           };
28

DESCRIPTION

30       Net::Twitter::Error encapsulates the "HTTP::Response" and Twitter error
31       HASH (if any) resulting from a failed API call.
32

METHODS

34       new Constructs a "Net::Twitter::Error" object.  It accepts the
35           following parameters:
36
37           http_response
38               An "HTTP::Response" object, required.
39
40           twitter_error
41               The error returned by Twitter as a HASH ref.  Optional, since
42               some API errors do not include a response from Twitter.  They
43               may, instead, be the result of network timeouts, proxy errors,
44               or some other problem that prevents an API response.
45
46       twitter_error
47           Get or set the Twitter error HASH.
48
49       http_response
50           Get or set the "HTTP::Response" object.
51
52       code
53           Returns the HTTP response code.
54
55       message
56           Returns the HTTP response message.
57
58       has_twitter_error
59           Returns true if the object contains a Twitter error HASH.
60
61       error
62           Returns the "error" value from the "twitter_error" HASH ref if
63           there is one.  Otherwise, it returns the string "[unknown]".
64           Includes a stack trace.
65
66       twitter_error_text
67           Returns the "error" value from the "twitter_error" HASH ref if
68           there is one.  Otherwise, returns an empty string
69
70       twitter_error_code
71           Returns the first numeric twitter error code from the JSON response
72           body, if there is one. Otherwise, it returns 0 so the result should
73           always be safe use in a numeric test.
74
75           See Twitter Error Codes <https://dev.twitter.com/docs/error-codes-
76           responses> for a list of defined error codes.
77
78       stack_trace
79           Returns a Devel::StackTrace object.
80
81       stack_frame($i)
82           Returns the $ith stack frame as a Devel::StackTrace::Frame object.
83

SEE ALSO

85       Net::Twitter
86

AUTHOR

88       Marc Mims <marc@questright.com>
89

LICENSE

91       Copyright (c) 2016 Marc Mims
92
93       This library is free software; you can redistribute it and/or modify it
94       under the same terms as Perl itself.
95

DISCLAIMER OF WARRANTY

97       BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
98       FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
99       WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
100       PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
101       EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
102       WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
103       ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
104       YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
105       NECESSARY SERVICING, REPAIR, OR CORRECTION.
106
107       IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
108       WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
109       REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE
110       TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
111       CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
112       SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
113       RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
114       FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
115       SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
116       DAMAGES.
117
118
119
120perl v5.32.0                      2020-07-28            Net::Twitter::Error(3)
Impressum