15.5 Accessing the Error Object
When a method call fails, it will invariably return an Error object identifying the nature of the failure. A common requirement within the catch statement is to gain access to this object so that appropriate corrective action can be taken within the app code. The following code demonstrates how such an error object is accessed from within a catch statement when attempting to create a new file system directory:
do {
try filemgr.createDirectory(atPath: newDir,
withIntermediateDirectories: true,
attributes: nil)
} catch let error {
print...