invent a new error for the bad escape usage

This commit is contained in:
Ward Wouts 2004-10-18 18:35:39 +00:00
parent 14d403d5b3
commit 745c164cec

View file

@ -1,4 +1,4 @@
# $Dwarf: yenc.rb,v 1.10 2004/06/16 08:14:50 ward Exp $ # $Dwarf: yenc.rb,v 1.11 2004/10/18 08:13:47 ward Exp $
# $Source$ # $Source$
# #
@ -19,6 +19,8 @@
require 'tempfile' require 'tempfile'
class YencError < RuntimeError; end
class YEnc class YEnc
class << self class << self
@ -53,10 +55,10 @@ def _ydecode_line(line)
ostr = '' ostr = ''
while i < ll while i < ll
if line[i] == 0x3d if line[i] == 0x3d
i += 1 if i == (ll - 1)
if i == ll raise YencError, "Escape char found as last char of line. This is not allowed by the yEnc standard"
raise PermError, "Escape char found as last char on line. This is not allowed by the yEnc standard"
else else
i += 1
line[i] -= 64 line[i] -= 64
end end
end end
@ -193,7 +195,6 @@ def _ydecode_file(file, outfile)
return mode, filename, outfile return mode, filename, outfile
end end
# toch maar een keer aparte class van maken... geld ook voor dit geneuzel
def _ydecode_array(data) def _ydecode_array(data)
decode = "" decode = ""
mode = 0600 mode = 0600