Sha256: 7deae5f7ce2b41de9e9671f922c88014a1662c27d477b25a993e58bfb8a871ef

Contents?: true

Size: 674 Bytes

Versions: 2

Compression:

Stored size: 674 Bytes

Contents

module XFTP
  # Raises when the given argument does not match required format
  class InvalidArgument < ArgumentError; end
  # Raises when required argument is missing or blank
  class MissingArgument < ArgumentError; end
  # Raise when the given protocol is not supported
  class NotSupportedProtocol < ArgumentError; end

  # Shortcut method to fail
  # with a localized error message
  module Errors
    def missing_setting!(setting)
      fail MissingArgument, I18n.t('errors.missing_setting', key: setting)
    end

    def not_supported_protocol!(protocol)
      fail NotSupportedProtocol, I18n.t('errors.not_supported_protocol', protocol: protocol)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xftp-0.2.0.pre.alpha lib/xftp/errors.rb
xftp-0.1.0.pre.alpha lib/xftp/errors.rb