some more exception handling

hide stuff behind degublevel
This commit is contained in:
Ward Wouts 2002-04-30 21:11:53 +00:00
parent 22f4154597
commit c10d73534c

View file

@ -30,7 +30,12 @@ def add(messid, id, subject)
end
def get_articles(group, cachedir=false)
resp, count, first, last, name = @nntp.group(group)
begin
resp, count, first, last, name = @nntp.group(group)
rescue Net::NNTP::RuntimeError
print "Couldn't open group: #{group}\n"
return false
end
read_cache(group, cachedir, first, last)
range = Set::IntSpan.new("#{first}-#{last}")
for i in (range.diff(@skip_ids).elements)
@ -61,7 +66,11 @@ end
def get_group_body(subj)
result = []
for i in @groups[subj]["messages"][1..@groups[subj]["messages"].length]
resp, id, messid, list = @nntp.body(i)
begin
resp, id, messid, list = @nntp.body(i)
rescue Net::NNTPReplyError
print "Caught Net::NNTPReplyError reading article #{@groups[subj]["messages"][0]}\n"
end
result = list
end
return result
@ -236,7 +245,7 @@ def _uudecode_file(file, outfile)
print "line: #{line}" if Debuglevel > 0
if line =~ /^begin(.*)/
m = $1
print "beginning matched; rest: #{m}\n"
print "beginning matched; rest: #{m}\n" if Debuglevel > 0
if m =~ /^(\s+(\d+))?(\s+(.*?\S))?\s*\Z/
mode = $2
filename = $4
@ -251,7 +260,7 @@ def _uudecode_file(file, outfile)
print "not uuencoded!\n" if file.eof
print "c: #{c} mark: #{mark} lines: #{lines}\n" if Debuglevel > 1
print "UUdecoding...\n"
print " UUdecoding...\n"
while (! file.eof)
if Debuglevel > 1
@ -298,7 +307,7 @@ def _uudecode_array(data)
print "i #{i}\n"
if data[i] =~ /^begin(.*)/
m = $1
print "beginning matched; rest: #{m}\n"
print "beginning matched; rest: #{m}\n" if Debuglevel > 0
if m =~ /^(\s+(\d+))?(\s+(.*?\S))?\s*\Z/
mode = $2
file = $4