Commit 4389c32a27b278fc2450b6234d8b4edeb0281982
1 parent
7a3e95b7
Exists in
master
and in
1 other branch
Fixed github issue #56 - Missing file field leads to exception
Showing
2 changed files
with
20 additions
and
1 deletions
Show diff stats
app/views/notices/_backtrace.html.haml
| ... | ... | @@ -9,8 +9,10 @@ |
| 9 | 9 | %td |
| 10 | 10 | %ul.lines |
| 11 | 11 | - lines.each do |line| |
| 12 | + - line['file'] = "[unknown source]" if line['file'].blank? | |
| 12 | 13 | - in_app = line['file'].gsub!('[PROJECT_ROOT]','') && !line['file'].match(/^\/vendor\//) |
| 13 | 14 | %li{:class => (in_app ? 'in-app' : nil)} |
| 14 | 15 | = line['file'] |
| 15 | 16 | → |
| 16 | - %strong= line['method'] | |
| 17 | 17 | \ No newline at end of file |
| 18 | + %strong= line['method'] | |
| 19 | + | ... | ... |
| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | +require 'spec_helper' | |
| 2 | + | |
| 3 | +describe "notices/_backtrace.html.haml" do | |
| 4 | + describe 'missing file in backtrace' do | |
| 5 | + it "should replace nil file with [unknown source]" do | |
| 6 | + notice = Factory(:notice, :backtrace => [{ | |
| 7 | + 'number' => rand(999), | |
| 8 | + 'file' => nil, | |
| 9 | + 'method' => ActiveSupport.methods.shuffle.first | |
| 10 | + }]) | |
| 11 | + assign :app, notice.err.app | |
| 12 | + render :partial => "notices/backtrace", :locals => {:lines => notice.backtrace} | |
| 13 | + rendered.should match(/\[unknown source\]/) | |
| 14 | + end | |
| 15 | + end | |
| 16 | +end | |
| 17 | + | ... | ... |