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.
The line
let url = try createURL(for: path, in: directory)
was in a try catch block, such that if an error was thrown insidecreateURL(...)
, it would be caught in thecatch
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.