Improved the CreatedRootFolderTask task in the library target to throw error in case the function receives an empty name.
This commit is contained in:
@@ -18,6 +18,10 @@ public struct CreateRootFolderTask {
|
||||
name: String,
|
||||
at location: URL? = nil
|
||||
) async throws -> URL {
|
||||
guard !name.isEmpty else {
|
||||
throw CreateRootFolderError.nameIsEmpty
|
||||
}
|
||||
|
||||
let rootFolder = if let location {
|
||||
location
|
||||
} else {
|
||||
@@ -36,3 +40,9 @@ public struct CreateRootFolderTask {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Errors
|
||||
|
||||
public enum CreateRootFolderError: Error {
|
||||
case nameIsEmpty
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user