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



207
208
209
# File 'lib/active_support/dependencies.rb', line 207

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

#blamed_filesObject



211
212
213
# File 'lib/active_support/dependencies.rb', line 211

def blamed_files
  @blamed_files ||= []
end

#copy_blame!(exc) ⇒ Object



220
221
222
223
# File 'lib/active_support/dependencies.rb', line 220

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

#describe_blameObject



215
216
217
218
# File 'lib/active_support/dependencies.rb', line 215

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