Skip to content

Commit 1a64749

Browse files
committed
handle parse errors gracefully
1 parent 9399f97 commit 1a64749

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

reindex.md renamed to REINDEX.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ elasticsearch:
2222

2323
rake task:bills_text debug=1 congress=113 && rake task:bills_text debug=1 congress=112 && rake task:bills_text debug=1 congress=111
2424

25-
rake task:regulations cache=1 debug=1 year=2014 && rake task:regulations cache=1 debug=1 year=2013 && rake task:regulations cache=1 debug=1 year=2012 && rake task:regulations debug=1 cache=1 year=2011 && rake task:regulations debug=1 cache=1 year=2010 && rake task:regulations debug=1 year=2009 cache=1
25+
rake task:regulations cache=1 debug=1 year=2014 && rake task:regulations cache=1 debug=1 year=2013 && rake task:regulations cache=1 debug=1 year=2012 && rake task:regulations debug=1 cache=1 year=2011
2626

27-
rake task:gao_reports cache=1 debug=1 year=2014 && rake task:gao_reports cache=1 debug=1 year=2013 && rake task:gao_reports cache=1 debug=1 year=2012 && rake task:gao_reports cache=1 debug=1 year=2011 && rake task:gao_reports cache=1 debug=1 year=2010 && rake task:gao_reports cache=1 debug=1 year=2009
27+
rake task:gao_reports cache=1 debug=1 year=2014 && rake task:gao_reports cache=1 debug=1 year=2013 && rake task:gao_reports cache=1 debug=1 year=2012 && rake task:gao_reports cache=1 debug=1 year=2011
2828

2929
rake task:videos archive=True captions=True && rake task:videos archive=True captions=True senate=True
3030

tasks/utils.rb

+7-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,13 @@ def self.download(url, options = {})
185185
return nil
186186
end
187187

188-
body = Yajl::Parser.parse(body) if body and options[:json]
188+
if body and options[:json]
189+
begin
190+
body = Yajl::Parser.parse(body)
191+
rescue Yajl::ParseError => exc
192+
return nil
193+
end
194+
end
189195

190196
# returns true or false if a destination is given
191197
if options[:destination]

0 commit comments

Comments
 (0)