Exception: TFTP::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/tftp/error.rb

Overview

An exception raised by TFTP code.

Constant Summary collapse

MESSAGES =
{
  :invalid_block_num    => "Block nums must begin with 1 and increase by one for each new block of data.",
  :no_filename_provided => "All RRQ/WRQ packets are required to have a filename.",
  :unsupported_mode => "Octet is the only mode currently supported."
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil) ⇒ Error

Returns a new instance of Error.

Parameters:

  • message (String) (defaults to: nil)

    The error message



17
18
19
# File 'lib/tftp/error.rb', line 17

def initialize(message = nil)
  super(message)
end

Class Method Details

.message(key, *args) ⇒ Object



11
12
13
14
# File 'lib/tftp/error.rb', line 11

def self.message(key, *args)
  string = MESSAGES[key] or raise "[TFTP BUG] No error messages for #{key}"
  (args.empty? ? string : string % args).rstrip
end