Exception: Exception

Defined in:
lib/active_support/dependencies.rb

Overview

Add file-blaming to exceptions

Instance Method Summary collapse

Instance Method Details

#blame_file!(file) ⇒ Object

:nodoc:



209
210
211
# File 'lib/active_support/dependencies.rb', line 209

def blame_file!(file)
  (@blamed_files ||= []).unshift file
end

#blamed_filesObject



213
214
215
# File 'lib/active_support/dependencies.rb', line 213

def blamed_files
  @blamed_files ||= []
end

#copy_blame!(exc) ⇒ Object



222
223
224
225
# File 'lib/active_support/dependencies.rb', line 222

def copy_blame!(exc)
  @blamed_files = exc.blamed_files.clone
  self
end

#describe_blameObject



217
218
219
220
# File 'lib/active_support/dependencies.rb', line 217

def describe_blame
  return nil if blamed_files.empty?
  "This error occured while loading the following files:\n   #{blamed_files.join "\n   "}"
end