Exception: Twitter::RESTError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Twitter::RESTError
- Includes:
- ClassUtilMixin
- Defined in:
- lib/vendor/twitter/lib/twitter/core.rb
Overview
Exception subclass raised when there is an error encountered upon querying or posting to the remote Twitter REST API.
To consume and query any RESTError
raised by Twitter4R:
begin
# Do something with your instance of <tt>Twitter::Client</tt>.
# Maybe something like:
timeline = twitter.timeline_for(:public)
rescue RESTError => re
puts re.code, re., re.uri
end
Which on the code raising a RESTError
will output something like:
404
Resource Not Found
/i_am_crap.json
Constant Summary collapse
- @@ATTRIBUTES =
[:code, :message, :uri]
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#message ⇒ Object
Returns the value of attribute message.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
-
#to_s ⇒ Object
Returns string in following format: “HTTP #@code: #@message at #@uri” For example, “HTTP 404: Resource Not Found at /i_am_crap.json”.
Methods included from ClassUtilMixin
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
105 106 107 |
# File 'lib/vendor/twitter/lib/twitter/core.rb', line 105 def code @code end |
#message ⇒ Object
Returns the value of attribute message.
105 106 107 |
# File 'lib/vendor/twitter/lib/twitter/core.rb', line 105 def @message end |
#uri ⇒ Object
Returns the value of attribute uri.
105 106 107 |
# File 'lib/vendor/twitter/lib/twitter/core.rb', line 105 def uri @uri end |
Instance Method Details
#to_s ⇒ Object
Returns string in following format:
"HTTP #{@code}: #{@message} at #{@uri}"
For example,
"HTTP 404: Resource Not Found at /i_am_crap.json"
111 112 113 |
# File 'lib/vendor/twitter/lib/twitter/core.rb', line 111 def to_s "HTTP #{@code}: #{@message} at #{@uri}" end |