Brian Neal  committed e328fcb Draft

Raise an exception if the requested day is not found in the key file.

  • Participants
  • Parent commits 1dac708

Comments (0)

Files changed (2)

File enigma/

         settings['plugboard_settings'] = ' '.join(cols[-11:-1])
         settings['reflector'] = cols[-1]
+    else:
+        raise KeyFileError('no entry for day %d found' % day)
         return settings

File enigma/

 from .machine import EnigmaMachine, EnigmaError
 from .rotors import RotorError
+from .keyfile import KeyFileError
 PROG_DESC = 'Encrypt/decrypt text according to Enigma machine key settings'
 def console_main():
-    except (IOError, EnigmaError, RotorError) as ex:
+    except (IOError, EnigmaError, RotorError, KeyFileError) as ex:
         sys.stderr.write("%s\n" % ex)