From Handling Cocoa Errors in Swift TIL, finally, how to catch only specific errors when making file operations, e.g. not throw if file doesn’t exist when deleting file:

do {
    try fileManager.moveItem(at: fromURL, to: toURL)
} catch CocoaError.fileNoSuchFile {
    print("Error: no such file exists")
} catch CocoaError.fileReadUnsupportedScheme {
    print("Error: unsupported scheme (should be 'file://')")
}