Permalink
Browse files

Merge pull request #571 from xslim/master

Podfile & Lockfile error handling
  • Loading branch information...
2 parents 11edeba + 303dbb5 commit 4b9f45940c6f4d0714b4ad058b1962115c64d8d6 @xslim xslim committed Oct 4, 2012
Showing with 10 additions and 2 deletions.
  1. +5 −1 lib/cocoapods/lockfile.rb
  2. +5 −1 lib/cocoapods/podfile.rb
@@ -8,7 +8,11 @@ class Lockfile
#
def self.from_file(path)
return nil unless path.exist?
- hash = YAML.load(File.open(path))
+ begin
+ hash = YAML.load(File.open(path))
+ rescue Exception => e
+ raise Informative, "Podfile.lock syntax error: #{e.inspect}"
+ end
lockfile = Lockfile.new(hash)
lockfile.defined_in_file = path
lockfile
View
@@ -177,7 +177,11 @@ def self.from_file(path)
string = File.open(path, 'r:utf-8') { |f| f.read }
# TODO: work around for Rubinius incomplete encoding in 1.9 mode
string.encode!('UTF-8') if string.respond_to?(:encoding) && string.encoding.name != "UTF-8"
- eval(string, nil, path.to_s)
+ begin
+ eval(string, nil, path.to_s)
+ rescue Exception => e
+ raise Informative, "Podfile syntax error: #{e.inspect}"
+ end
end
podfile.defined_in_file = path
podfile.validate!

0 comments on commit 4b9f459

Please sign in to comment.