Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid 500 error when backtrace object is nil #1276

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -19,4 +19,5 @@ bundle
coverage
*#
.ruby-version
.tool-versions
NOTES
2 changes: 1 addition & 1 deletion app/decorators/backtrace_line_decorator.rb
Expand Up @@ -15,7 +15,7 @@ def column
end

def file
object[:file].to_s
object.try(:[], :file).to_s
end

def method
Expand Down
7 changes: 7 additions & 0 deletions spec/decorators/backtrace_line_decorator_spec.rb
Expand Up @@ -14,6 +14,9 @@
let(:backtrace_line_no_file) do
described_class.new(number: 884, method: :instance_eval)
end
let(:backtrace_line_no_object) do
described_class.new(nil)
end
let(:app) { Fabricate(:app, github_repo: 'foo/bar') }

describe '#to_s' do
Expand All @@ -26,6 +29,10 @@
it 'returns "" when there is no file' do
expect(backtrace_line_no_file.file).to eq('')
end

it 'returns "" when there is no object' do
expect(backtrace_line_no_object.file).to eq('')
end
end

describe '#in_app?' do
Expand Down