Skip to content

Instantly share code, notes, and snippets.

@tborisova
Last active August 29, 2015 14:13
Show Gist options
  • Save tborisova/0c2dd4eee821e26f9c81 to your computer and use it in GitHub Desktop.
Save tborisova/0c2dd4eee821e26f9c81 to your computer and use it in GitHub Desktop.
Task to list all exceptions that can happen in Rails app
namespace :exceptions do
task :list => :environment do
exceptions = []
ObjectSpace.each_object(Class) do |k|
exceptions << k if k.ancestors.include?(Exception)
end
puts exceptions.sort { |a,b| a.to_s <=> b.to_s }.join("\n")
end
end
#bundle exec rake exceptions:list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment