Upgraded to Rails 2.0.2, except that we maintain vendor/rails/actionpack/lib/action_controller/routing.rb from Rail 1.2.6 (at least for now), so that Routes don't change. We still get to enjoy Rails's many new features. Also fixed a bug in Chunk-handling: disable WikiWord processing in tags (for real this time).
34 lines
872 B
Ruby
34 lines
872 B
Ruby
class Exception # :nodoc:
|
|
def clean_message
|
|
Pathname.clean_within message
|
|
end
|
|
|
|
TraceSubstitutions = []
|
|
FrameworkRegexp = /generated|vendor|dispatch|ruby|script\/\w+/
|
|
|
|
def clean_backtrace
|
|
backtrace.collect do |line|
|
|
Pathname.clean_within(TraceSubstitutions.inject(line) do |result, (regexp, sub)|
|
|
result.gsub regexp, sub
|
|
end)
|
|
end
|
|
end
|
|
|
|
def application_backtrace
|
|
before_application_frame = true
|
|
|
|
trace = clean_backtrace.reject do |line|
|
|
non_app_frame = (line =~ FrameworkRegexp)
|
|
before_application_frame = false unless non_app_frame
|
|
non_app_frame && ! before_application_frame
|
|
end
|
|
|
|
# If we didn't find any application frames, return an empty app trace.
|
|
before_application_frame ? [] : trace
|
|
end
|
|
|
|
def framework_backtrace
|
|
clean_backtrace.grep FrameworkRegexp
|
|
end
|
|
end
|