saoudrizwan / Disk

Delightful framework for iOS to easily persist structs, images, and data
MIT License
3.08k stars 170 forks source link

We no longer catch an error just to throw it again. #66

Open BenMaer-Parkwood opened 5 years ago

BenMaer-Parkwood commented 5 years ago

The line let url = try createURL(for: path, in: directory) was in a try catch block, such that if an error was thrown inside createURL(...), it would be caught in the catch block, only to be thrown again.

The same issue was the case for the error thrown if FileManager.default.fileExists(atPath: url.path) returned true. It would throw the error, then catch it, then throw it again.

Seeing how there was no extra logic that was performed by the catch block, there was no reason to have that catch block.

This update makes changes so that the redundant catch and throw is avoided.