bignerdranch / Freddy

A reusable framework for parsing JSON in Swift.
MIT License
1.09k stars 120 forks source link

Replace assertions with errors #268

Closed davidahouse closed 6 years ago

davidahouse commented 6 years ago

Instead of crashing the entire app, this PR turns those cases into thrown errors. Now the calling app can chose what to do in these cases.

Note: These are all internal parsing code errors, so ideally these will not happen unless the parsing code itself is broken. But either way it is more friendly in this case to throw a catchable error rather than crashing.

This will also close #258 with a more robust fix than #259.

Marking with do not merge for now until we create a Xcode 9 / Swift 3.2 release and also depends on #267 .