summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-05-06 03:09:03 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-05-06 03:09:03 +0000
commit6b7b84edc7168786408b0757e2eb53728d1b71a6 (patch)
tree299c41408ef82854a829327d1f8d5c4cc8cf6a8c /lib
parent53118356b53259b456aabc11fb1212d965251fc4 (diff)
new exception model
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/pstore.rb11
-rw-r--r--lib/weakref.rb3
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/pstore.rb b/lib/pstore.rb
index b93420d..3f95e8c 100644
--- a/lib/pstore.rb
+++ b/lib/pstore.rb
@@ -15,7 +15,8 @@
require "marshal"
class PStore
- Exception(:Error)
+ class Error < StandardError
+ end
def initialize(file)
dir = File::dirname(file)
@@ -90,13 +91,17 @@ class PStore
end
ensure
unless @abort
- File::rename @filename, @filename+"~"
+ begin
+ File::rename @filename, @filename+"~"
+ rescue Errno::ENOENT
+ no_orig = true
+ end
begin
File::open(@filename, "w") do |file|
Marshal::dump(@table, file)
end
rescue
- File::rename @filename+"~", @filename
+ File::rename @filename+"~", @filename unless no_orig
end
end
@abort = false
diff --git a/lib/weakref.rb b/lib/weakref.rb
index 6a6dcec..6ef4b42 100644
--- a/lib/weakref.rb
+++ b/lib/weakref.rb
@@ -12,7 +12,8 @@ require "delegate"
class WeakRef<Delegator
- Exception :RefError
+ class RefError<StandardError
+ end
ID_MAP = {}
ID_REV_MAP = {}