Skip to content

Commit 0dd7bd3

Browse files
author
Michalis Karagiorgos
committed
improve error handling
1 parent 6785cbd commit 0dd7bd3

11 files changed

Lines changed: 26 additions & 26 deletions

Sources/Errors/ConfigurationLoaderError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ enum ConfigurationLoaderError: Error, CustomStringConvertible, Equatable {
1414
var description: String {
1515
switch self {
1616
case .configurationFileNotFound(let path):
17-
"❌ Configuration file not found at path: \(path)"
17+
"error: ❌ Configuration file not found at path: \(path)"
1818
}
1919
}
2020
}

Sources/Errors/DuplicatesError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ enum DuplicatesError: Error, CustomStringConvertible, Equatable {
1515
var description: String {
1616
switch self {
1717
case .duplicateEntries(let duplicates, let context):
18-
"❌ Duplicate \(context) entries found:\n\(duplicates.joined(separator: ", "))"
18+
"error: ❌ Duplicate \(context) entries found:\n\(duplicates.joined(separator: ", "))"
1919
}
2020
}
2121
}

Sources/Errors/ExclusivesError.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ enum ExclusivesError: Error, CustomStringConvertible, Equatable {
2727
var description: String {
2828
switch self {
2929
case .invalidTargetName(let name):
30-
"❌ Target name \(name) inside exclusive section doesn't exist in the project"
30+
"error: ❌ Target name \(name) inside exclusive section doesn't exist in the project"
3131
case .invalidPathForTarget(let targetName, let path):
32-
"❌ Path \(path) inside exclusive section for target \(targetName) doesn't exist in the project"
32+
"error: ❌ Path \(path) inside exclusive section for target \(targetName) doesn't exist in the project"
3333
case .exclusiveEntriesFound(let targetNames):
34-
"❌ Exclusive entries found for targets: \(targetNames)"
34+
"error: ❌ Exclusive entries found for targets: \(targetNames)"
3535
}
3636
}
3737
}

Sources/Errors/ForbiddenResourceError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct ForbiddenResourceError: Error, CustomStringConvertible, Equatable {
1111

1212
/// A human readable, multiline description enumerating each forbidden resource path found.
1313
var description: String {
14-
"❌ Forbidden resource(s) found in target \(targetName):\n" +
14+
"error: ❌ Forbidden resource(s) found in target \(targetName):\n" +
1515
matchingPaths
1616
.map { " - \($0)" }
1717
.sorted()

Sources/Errors/XcodeProjectParserError.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ enum XcodeProjectParserError: Error, CustomStringConvertible, Equatable {
3535
var description: String {
3636
switch self {
3737
case .invalidTargetName(let name):
38-
"❌ Invalid target name \(name)"
38+
"error: ❌ Invalid target name \(name)"
3939
case .invalidPath(let path):
40-
"❌ Invalid path \(path)"
40+
"error: ❌ Invalid path \(path)"
4141
case .failedToResolveBuildableFolderPath(let path):
42-
"❌ Failed to resolve buildable folder path \(path)"
42+
"error: ❌ Failed to resolve buildable folder path \(path)"
4343
case .forbiddenBuildableFoldersForGroups(let groups):
44-
"❌ Forbidden buildable folders for groups: \n\(groups.joined(separator: ", \n"))"
44+
"error: ❌ Forbidden buildable folders for groups: \n\(groups.joined(separator: ", \n"))"
4545
case .exceptionSetTargetIsNil(let groupPath):
46-
"❌ Exception set target is nil for group at path: \(groupPath)"
46+
"error: ❌ Exception set target is nil for group at path: \(groupPath)"
4747
case .exceptionSetTargetProductTypeIsNil(let groupPath):
48-
"❌ Exception set target product type is nil for group at path: \(groupPath)"
48+
"error: ❌ Exception set target product type is nil for group at path: \(groupPath)"
4949
}
5050
}
5151
}

Sources/Exclusives/ExclusivesProcessor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ private extension ExclusivesProcessor {
159159
targets: String
160160
) {
161161
guard !entries.isEmpty else { return }
162-
print("Exclusive \(kind) found between targets \(targets):")
162+
print("error: ❌ Exclusive \(kind) found between targets \(targets):")
163163
for entry in entries.sorted() {
164164
print(" - \(entry)")
165165
}

Tests/XcodeTargetsTests/Errors/DuplicatesErrorTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct DuplicatesErrorTests {
1818
let description = error.description
1919

2020
// Then
21-
let expectedDescription = "❌ Duplicate testContext entries found:\nItem1, Item2, Item3"
21+
let expectedDescription = "error: ❌ Duplicate testContext entries found:\nItem1, Item2, Item3"
2222
#expect(description == expectedDescription)
2323
}
2424

Tests/XcodeTargetsTests/Errors/ExclusivesErrorTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct ExclusivesErrorTests {
1313
let description = sut.description
1414

1515
// Then
16-
#expect(description == "❌ Target name MyTarget inside exclusive section doesn't exist in the project")
16+
#expect(description == "error: ❌ Target name MyTarget inside exclusive section doesn't exist in the project")
1717
}
1818

1919
@Test("test description of invalidPathForTarget")
@@ -25,7 +25,7 @@ struct ExclusivesErrorTests {
2525
let description = sut.description
2626

2727
// Then
28-
#expect(description == "❌ Path Sources/NonExistent inside exclusive section for target MyTarget doesn't exist in the project")
28+
#expect(description == "error: ❌ Path Sources/NonExistent inside exclusive section for target MyTarget doesn't exist in the project")
2929
}
3030

3131
@Test("test description of exclusiveEntriesFound")
@@ -37,6 +37,6 @@ struct ExclusivesErrorTests {
3737
let description = sut.description
3838

3939
// Then
40-
#expect(description == "❌ Exclusive entries found for targets: MyTarget1, MyTarget2")
40+
#expect(description == "error: ❌ Exclusive entries found for targets: MyTarget1, MyTarget2")
4141
}
4242
}

Tests/XcodeTargetsTests/Errors/ForbiddenResourceErrorTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ struct ForbiddenResourceErrorTests {
1717
let description = error.description
1818

1919
// Then
20-
#expect(description == "❌ Forbidden resource(s) found in target TargetA:\n - Sources/Forbidden/AnotherFile.swift\n - Sources/Forbidden/File.swift")
20+
#expect(description == "error: ❌ Forbidden resource(s) found in target TargetA:\n - Sources/Forbidden/AnotherFile.swift\n - Sources/Forbidden/File.swift")
2121
}
2222
}

Tests/XcodeTargetsTests/Errors/XcodeProjectParserErrorTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct XcodeProjectParserErrorTests {
1414
let message = sut.description
1515

1616
// Then
17-
#expect(message == "❌ Invalid target name InvalidTarget")
17+
#expect(message == "error: ❌ Invalid target name InvalidTarget")
1818
}
1919

2020
@Test("test description with invalid path returns expected message")
@@ -27,7 +27,7 @@ struct XcodeProjectParserErrorTests {
2727
let message = sut.description
2828

2929
// Then
30-
#expect(message == "❌ Invalid path Some/Invalid/Path")
30+
#expect(message == "error: ❌ Invalid path Some/Invalid/Path")
3131
}
3232

3333
@Test("test description with failed to resolve buildable folder path returns expected message")
@@ -40,7 +40,7 @@ struct XcodeProjectParserErrorTests {
4040
let message = sut.description
4141

4242
// Then
43-
#expect(message == "❌ Failed to resolve buildable folder path Sources/Module/Buildable")
43+
#expect(message == "error: ❌ Failed to resolve buildable folder path Sources/Module/Buildable")
4444
}
4545

4646
@Test("test description with forbidden buildable folders for groups returns expected message")
@@ -53,7 +53,7 @@ struct XcodeProjectParserErrorTests {
5353
let message = sut.description
5454

5555
// Then
56-
let expected = "❌ Forbidden buildable folders for groups: \nGroupA, \nGroupB, \nGroupC"
56+
let expected = "error: ❌ Forbidden buildable folders for groups: \nGroupA, \nGroupB, \nGroupC"
5757
#expect(message == expected)
5858
}
5959

@@ -67,7 +67,7 @@ struct XcodeProjectParserErrorTests {
6767
let message = sut.description
6868

6969
// Then
70-
let expected = "❌ Forbidden buildable folders for groups: \n"
70+
let expected = "error: ❌ Forbidden buildable folders for groups: \n"
7171
#expect(message == expected)
7272
}
7373

@@ -81,7 +81,7 @@ struct XcodeProjectParserErrorTests {
8181
let message = sut.description
8282

8383
// Then
84-
#expect(message == "❌ Exception set target is nil for group at path: Sources/Group/Path")
84+
#expect(message == "error: ❌ Exception set target is nil for group at path: Sources/Group/Path")
8585
}
8686

8787
@Test("test description with exception set target product type is nil returns expected message")
@@ -94,7 +94,7 @@ struct XcodeProjectParserErrorTests {
9494
let message = sut.description
9595

9696
// Then
97-
#expect(message == "❌ Exception set target product type is nil for group at path: Sources/Group/AnotherPath")
97+
#expect(message == "error: ❌ Exception set target product type is nil for group at path: Sources/Group/AnotherPath")
9898
}
9999

100100
// MARK: - Equatable

0 commit comments

Comments
 (0)