Last active
August 29, 2015 14:13
-
-
Save tborisova/0c2dd4eee821e26f9c81 to your computer and use it in GitHub Desktop.
Task to list all exceptions that can happen in Rails app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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