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