Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Podfile & Lockfile error handling #571

Merged
merged 2 commits into from

2 participants

@xslim

Errors in syntax can come from bad merging for example.

@xslim

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

@fabiopelosin
Owner

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 :-)

@fabiopelosin
Owner

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

@xslim

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
@fabiopelosin
Owner

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
View
6 lib/cocoapods/lockfile.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
6 lib/cocoapods/podfile.rb
@@ -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!
Something went wrong with that request. Please try again.