mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-06 01:08:21 +01:00
handle unconfigured twitter's keys
This commit is contained in:
parent
fc1f19a92f
commit
8419efc7f5
@ -9,7 +9,12 @@ class API::FeedsController < API::ApiController
|
|||||||
limit = 3
|
limit = 3
|
||||||
end
|
end
|
||||||
from_account = Setting.find_by(name: 'twitter_name').try(:value) || ENV['TWITTER_NAME']
|
from_account = Setting.find_by(name: 'twitter_name').try(:value) || ENV['TWITTER_NAME']
|
||||||
@tweet_news = Feed.twitter.user_timeline(from_account, {count: limit})
|
begin
|
||||||
|
@tweet_news = Feed.twitter.user_timeline(from_account, {count: limit})
|
||||||
|
rescue Twitter::Error::BadRequest => e
|
||||||
|
STDERR.puts "[WARNING] Unable to retrieve the twitter feed, please check your ENV configuration. Details: #{e.message}"
|
||||||
|
render status: :no_content
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user