Skip to content

Commit f064099

Browse files
committed
Added throws on Dir.forEachEntry
1 parent 719e605 commit f064099

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/PerfectLib/Dir.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public struct Dir {
124124
/// Enumerates the contents of the directory passing the name of each contained element to the provided callback.
125125
/// - parameter closure: The callback which will receive each entry's name
126126
/// - throws: `PerfectError.FileError`
127-
public func forEachEntry(closure: (name: String) -> ()) throws {
127+
public func forEachEntry(closure: (name: String) throws -> ()) throws {
128128
guard let dir = opendir(realPath) else {
129129
try ThrowFileError()
130130
}
@@ -159,9 +159,9 @@ public struct Dir {
159159
nameBuf.append(0)
160160
if let name = String(validatingUTF8: nameBuf) where !(name == "." || name == "..") {
161161
if Int32(type) == Int32(DT_DIR) {
162-
closure(name: name + "/")
162+
try closure(name: name + "/")
163163
} else {
164-
closure(name: name)
164+
try closure(name: name)
165165
}
166166
}
167167
}

0 commit comments

Comments
 (0)