Skip to content

Commit

Permalink
Catch errors with frame loading
Browse files Browse the repository at this point in the history
  • Loading branch information
jpeace committed Mar 29, 2012
1 parent 93cadd3 commit 81c114d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/horseman/dom/document.rb
Expand Up @@ -65,8 +65,13 @@ def parse!(body)
end

doc.css('frame').select{|f| f.attr('src') && f.attr('name')}.each do |f|
frame_body = open(f.attr('src')) {|f| f.read.strip}
@frames[f.attr('name').to_sym] = Document.new(frame_body)
frame_src = f.attr('src')
begin
frame_body = open(frame_src) {|f| f.read.strip}
@frames[f.attr('name').to_sym] = Document.new(frame_body)
rescue
puts "Could not load frame at #{frame_src}"
end
end

@dom = doc
Expand Down

0 comments on commit 81c114d

Please sign in to comment.