Skip to content

Commit

Permalink
Always use raise to signal exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Feb 4, 2016
1 parent 1b74de1 commit 4c0c864
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ end
group :test do
gem 'coveralls'
gem 'rspec', '>= 2.14'
gem 'rubocop', '>= 0.27'
gem 'rubocop', '>= 0.37'
gem 'simplecov', '>= 0.9'
gem 'timecop'
gem 'webmock'
Expand Down
4 changes: 2 additions & 2 deletions lib/twitter/null_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ def respond_to?(*)
end

def instance_of?(klass)
fail(TypeError, 'class or module required') unless klass.is_a?(Class)
raise(TypeError, 'class or module required') unless klass.is_a?(Class)
self.class == klass
end

def kind_of?(mod)
fail(TypeError, 'class or module required') unless mod.is_a?(Module)
raise(TypeError, 'class or module required') unless mod.is_a?(Module)
self.class.ancestors.include?(mod)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/rest/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def mime_type(basename)

def fail_or_return_response_body(code, body, headers)
error = error(code, body, headers)
fail(error) if error
raise(error) if error
@rate_limit = Twitter::RateLimit.new(headers)
body
end
Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/streaming/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def <<(data)

def on_headers_complete(_headers)
error = Twitter::Error::ERRORS[@parser.status_code]
fail error if error
raise error if error
end

def on_body(data)
Expand Down

0 comments on commit 4c0c864

Please sign in to comment.