Permalink
Browse files

Merge branch 'stable'

* stable:
  Handle more possible Marshal errors in CacheStore#store and CacheStore#retrieve methods.
  • Loading branch information...
2 parents d30f409 + 0d4aa34 commit a1ef2cddaee971d84d0e5e26329727ab0c7be884 @chriseppstein chriseppstein committed May 2, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/sass/cache_stores/base.rb
@@ -49,6 +49,8 @@ def _retrieve(key, version, sha)
# @param obj [Object] The object to cache.
def store(key, sha, root)
_store(key, Sass::VERSION, sha, Marshal.dump(root))
+ rescue TypeError, LoadError => e
+ Sass::Util.sass_warn "Warning. Error encountered while saving cache #{path_to(key)}: #{e}"
end
# Retrieve a {Sass::Tree::RootNode}.
@@ -59,7 +61,7 @@ def store(key, sha, root)
def retrieve(key, sha)
contents = _retrieve(key, Sass::VERSION, sha)
Marshal.load(contents) if contents
- rescue EOFError, TypeError, ArgumentError => e
+ rescue EOFError, TypeError, ArgumentError, LoadError => e
Sass::Util.sass_warn "Warning. Error encountered while reading cache #{path_to(key)}: #{e}"
end

0 comments on commit a1ef2cd

Please sign in to comment.