Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Podfile & Lockfile error handling #571

merged 2 commits into from

2 participants


Errors in syntax can come from bad merging for example.


What do you think about this?
If it looks fine, should I merge it & update the Changelog?


A much needed improvement. If you consider it a bug fix go ahead and merge, if it is a feature let me release the 0.15.1 for maintenance because there are some horrible bugs out there :-)


I was thinking about something similar for the podspecs, what do you think?


Well, hard to say if it's a bug fix or improvement)
I just had a merge conflict and almost submitted a ticket for Psych parser )
So this will help non-experienced users to see that the problem is in their files, not in cocoapods )

@xslim xslim merged commit 4b9f459 into CocoaPods:master

1 check passed

Details default The Travis build passed

Well, hard to say if it's a bug fix or improvement

That's why I asked :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 2 deletions.
  1. +5 −1 lib/cocoapods/lockfile.rb
  2. +5 −1 lib/cocoapods/podfile.rb
6 lib/cocoapods/lockfile.rb
@@ -8,7 +8,11 @@ class Lockfile
def self.from_file(path)
return nil unless path.exist?
- hash = YAML.load(
+ begin
+ hash = YAML.load(
+ rescue Exception => e
+ raise Informative, "Podfile.lock syntax error: #{e.inspect}"
+ end
lockfile =
lockfile.defined_in_file = path
6 lib/cocoapods/podfile.rb
@@ -177,7 +177,11 @@ def self.from_file(path)
string =, 'r:utf-8') { |f| }
# TODO: work around for Rubinius incomplete encoding in 1.9 mode
string.encode!('UTF-8') if string.respond_to?(:encoding) && != "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
podfile.defined_in_file = path
Something went wrong with that request. Please try again.