Last active
October 10, 2016 14:16
-
-
Save adis-io/7b09ca0387d78f3cee31cd65a1e5c51f to your computer and use it in GitHub Desktop.
Re raise exception with custom message
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
env = ENV.fetch('APP_ENV', 'development') | |
begin | |
storage_config = YAML.load_file("#{Rails.root.to_s}/config/storage.yml")[env] | |
rescue Errno::ENOENT | |
message = ".config/storage.yml not found! Perhaps you forgot to copy it from storage.yml.example? (#{$!})" | |
raise $!, message, $!.backtrace | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment