diff options
author | Andre Arko <andre@arko.net> | 2013-02-18 21:41:38 -0800 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2013-02-18 21:41:38 -0800 |
commit | bfc0632ff891a9c33cf3caf3cae34d47875f8baf (patch) | |
tree | 12ef5acf55cb83a685ce86b698e80bf82f058b8d /lib/bundler.rb | |
parent | 332cd2f9dfab04e49330eac20ba8a0e3a3984c3b (diff) | |
download | bundler-bfc0632ff891a9c33cf3caf3cae34d47875f8baf.tar.gz |
abstract Marshal.load failures
Diffstat (limited to 'lib/bundler.rb')
-rw-r--r-- | lib/bundler.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index 791a71cb..61fb7a07 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -81,6 +81,7 @@ module Bundler end class InvalidSpecSet < StandardError; end + class MarshalError < StandardError; end class << self attr_writer :ui, :bundle_path @@ -284,6 +285,12 @@ module Bundler File.open(file, "rb") { |f| f.read } end + def load_marshal(data) + Marshal.load(data) + rescue => e + raise MarshalError, "#{e.class}: #{e.message}" + end + def load_gemspec(file) @gemspec_cache ||= {} key = File.expand_path(file) |