Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/raven/interfaces/stack_trace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ def filename
return nil if self.abs_path.nil?

prefix = $LOAD_PATH.select { |s| self.abs_path.start_with?(s.to_s) }.sort_by { |s| s.to_s.length }.last
if prefix.nil? && Raven.configuration.project_root
project_root = Raven.configuration.project_root.to_s
if self.abs_path.start_with?(project_root)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This self is unnecessary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confusing I know since we use it everywhere else in this method.

prefix = project_root
end
end
prefix ? self.abs_path[prefix.to_s.chomp(File::SEPARATOR).length+1..-1] : self.abs_path
end

Expand Down
4 changes: 2 additions & 2 deletions spec/raven/event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,11 @@ class SubExc < BaseExc; end
expect(frames[1][:in_app]).to eq(false)
expect(frames[2][:filename]).to eq("/gem/lib/path")
expect(frames[2][:in_app]).to eq(false)
expect(frames[3][:filename]).to eq("/rails/root/app/foobar")
expect(frames[3][:filename]).to eq("app/foobar")
expect(frames[3][:in_app]).to eq(true)
expect(frames[4][:filename]).to eq("vendor/bundle/some_gem.rb")
expect(frames[4][:in_app]).to eq(false)
expect(frames[5][:filename]).to eq("/rails/root/vendor/bundle/cache/other_gem.rb")
expect(frames[5][:filename]).to eq("vendor/bundle/cache/other_gem.rb")
expect(frames[5][:in_app]).to eq(false)
end
end
Expand Down