Sha256: e3d3f7eb61d3c0266cdc013d0e7874036201d18225f947526e5101c633213645

Contents?: true

Size: 1009 Bytes

Versions: 39

Compression:

Stored size: 1009 Bytes

Contents

module ActiveSupport
  if RUBY_VERSION >= '1.9'
    FrozenObjectError = RuntimeError
  else
    FrozenObjectError = TypeError
  end
end

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

Version data entries

39 entries across 38 versions & 13 rubygems

Version Path
radiant-0.7.2 vendor/rails/activesupport/lib/active_support/core_ext/exception.rb
vibes-bj-1.2.2 spec/rails_root/vendor/rails/activesupport/lib/active_support/core_ext/exception.rb
vibes-bj-1.2.1 spec/rails_root/vendor/rails/activesupport/lib/active_support/core_ext/exception.rb
nbudin-castronaut-0.7.5 vendor/activesupport/lib/active_support/core_ext/exception.rb
usher-0.7.0 spec/rails2_2/vendor/rails/vendor/rails/activesupport/pkg/activesupport-2.2.2/lib/active_support/core_ext/exception.rb
usher-0.7.0 spec/rails2_2/vendor/rails/vendor/rails/activesupport/lib/active_support/core_ext/exception.rb
factorylabs-castronaut-0.7.5 vendor/activesupport/lib/active_support/core_ext/exception.rb
activesupport-2.2.3 lib/active_support/core_ext/exception.rb
activesupport-2.1.0 lib/active_support/core_ext/exception.rb
activesupport-2.1.2 lib/active_support/core_ext/exception.rb
activesupport-2.1.1 lib/active_support/core_ext/exception.rb
activesupport-2.2.2 lib/active_support/core_ext/exception.rb
antfarm-0.3.0 rails/vendor/rails/activesupport/lib/active_support/core_ext/exception.rb
antfarm-0.4.0 rails/vendor/rails/activesupport/lib/active_support/core_ext/exception.rb
mack-active_record-0.8.2 lib/gems/activesupport-2.2.2/lib/active_support/core_ext/exception.rb
mack-facets-0.8.3 lib/gems/activesupport-2.2.2/lib/active_support/core_ext/exception.rb
mack-facets-0.8.3.1 lib/gems/activesupport-2.2.2/lib/active_support/core_ext/exception.rb
radiant-0.7.0 vendor/rails/activesupport/lib/active_support/core_ext/exception.rb
radiant-0.7.1 vendor/rails/activesupport/lib/active_support/core_ext/exception.rb