lib/longleaf/services/application_config_deserializer.rb in longleaf-0.1.0 vs lib/longleaf/services/application_config_deserializer.rb in longleaf-0.2.0.pre.1
- old
+ new
@@ -1,16 +1,16 @@
require 'longleaf/services/application_config_validator'
require 'longleaf/services/application_config_manager'
-# Deserializer for application configuration files
module Longleaf
+ # Deserializer for application configuration files
class ApplicationConfigDeserializer
# Deserializes a valid application configuration file as a ApplicationConfigManager option
# @param config_path [String] file path to the application configuration file
# @param format [String] encoding format of the config file
- # return [Longleaf::ApplicationConfigManager] manager for the loaded configuration
+ # return [ApplicationConfigManager] manager for the loaded configuration
def self.deserialize(config_path, format: 'yaml')
config = load(config_path, format: format)
Longleaf::ApplicationConfigValidator.validate(config)
Longleaf::ApplicationConfigManager.new(config)
@@ -33,14 +33,12 @@
def self.from_yaml(config_path)
begin
YAML.load_file(config_path)
rescue Errno::ENOENT => err
raise Longleaf::ConfigurationError.new(
- "Cannot load application configuration, file #{config_path} does not exist.")
+ "Configuration file #{config_path} does not exist.")
rescue => err
- raise Longleaf::ConfigurationError.new(
- %Q(Failed to load application configuration due to the following reason:
- #{err.message}))
+ raise Longleaf::ConfigurationError.new(err)
end
end
end
end
\ No newline at end of file