lib/symmetric_encryption/railtie.rb in symmetric-encryption-3.8.1 vs lib/symmetric_encryption/railtie.rb in symmetric-encryption-3.8.2

- old
+ new

@@ -35,13 +35,19 @@ config.before_configuration do # Check if already configured unless ::SymmetricEncryption.cipher? config_file = Rails.root.join('config', 'symmetric-encryption.yml') if config_file.file? - ::SymmetricEncryption::Config.load!(config_file, Rails.env) + begin + ::SymmetricEncryption::Config.load!(config_file, Rails.env) + rescue ArgumentError => exc + puts "\nSymmetric Encryption not able to read keys." + puts "#{exc.class.name} #{exc.message}" + puts "To generate key files: bin/rails generate symmetric_encryption:new_keys #{Rails.env}\n\n" + end else puts "\nSymmetric Encryption config not found." - puts "To generate one for the first time: rails generate symmetric_encryption:config\n\n" + puts "To generate one for the first time: bin/rails generate symmetric_encryption:config\n\n" end end end end