From 57a1062089b323affd546fda99e9b3ab459bdcb6 Mon Sep 17 00:00:00 2001 From: Ward Wouts Date: Mon, 20 Jun 2005 07:29:14 +0000 Subject: [PATCH] catch weird error --- trunk/ripnews/ripnews.rb | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/trunk/ripnews/ripnews.rb b/trunk/ripnews/ripnews.rb index c5ee660..cb83e92 100755 --- a/trunk/ripnews/ripnews.rb +++ b/trunk/ripnews/ripnews.rb @@ -1,6 +1,6 @@ -#!/usr/local/bin/ruby -w +#!/usr/bin/ruby -w -# $Dwarf: ripnews.rb,v 1.106 2005/05/18 21:52:51 ward Exp $ +# $Dwarf: ripnews.rb,v 1.107 2005/06/06 12:53:10 ward Exp $ # $Source$ # @@ -112,11 +112,18 @@ def save_file(dir, name, data) return false end when "Array" - if file = File.new("#{dir}/#{newname}", "w", 0644) - print " Saving as: '#{newname}'\n" - data.collect{|i| file.print "#{i}"} - else - print "couldn't open file for writeing\n" + begin + if file = File.new("#{dir}/#{newname}", "w", 0644) + print " Saving as: '#{newname}'\n" + data.collect{|i| file.print "#{i}"} + else + print "couldn't open file for writeing\n" + return false + end + rescue Errno::EINVAL + print "Caught Errno::EINVAL (save_file)\n" + print "Error: #{$!}\n" + print "What the *beep* happened?\n" return false end when "Tempfile"