Clean up exception error messaging.
Removed the duplicated errors and reduced messaging to the source of
the exception, avoid repeating what has already been Syslogged.
--
PiperOrigin-RevId: 168298654
MOS_MIGRATED_REVID=168298654
diff --git a/src/Tulsi/HeadlessModeError.swift b/src/Tulsi/HeadlessModeError.swift
index 434ef20..d74160f 100644
--- a/src/Tulsi/HeadlessModeError.swift
+++ b/src/Tulsi/HeadlessModeError.swift
@@ -26,7 +26,7 @@
/// The given configuration file requires that an explicit output path be given.
case explicitOutputOptionRequired
/// XCode project generation failed for the given reason.
- case generationFailed(String)
+ case generationFailed
/// The path to the Bazel binary given on the commandline is invalid.
case invalidBazelPath
/// A workspace root override was given but references an invalid param.
diff --git a/src/Tulsi/HeadlessXcodeProjectGenerator.swift b/src/Tulsi/HeadlessXcodeProjectGenerator.swift
index 2bc1dca..d94aeb4 100644
--- a/src/Tulsi/HeadlessXcodeProjectGenerator.swift
+++ b/src/Tulsi/HeadlessXcodeProjectGenerator.swift
@@ -114,8 +114,8 @@
print("Opening generated project in Xcode")
NSWorkspace.shared().open(url)
}
- case .failure(let errorInfo):
- throw HeadlessModeError.generationFailed(errorInfo)
+ case .failure:
+ throw HeadlessModeError.generationFailed
}
}
diff --git a/src/Tulsi/TulsiGeneratorConfigDocument.swift b/src/Tulsi/TulsiGeneratorConfigDocument.swift
index f10d2bb..05f61ab 100644
--- a/src/Tulsi/TulsiGeneratorConfigDocument.swift
+++ b/src/Tulsi/TulsiGeneratorConfigDocument.swift
@@ -36,8 +36,8 @@
enum GenerationResult {
/// Generation succeeded. The associated URL points at the generated Xcode project.
case success(URL)
- /// Generation failed. The associated String provides error info.
- case failure(String)
+ /// Generation failed.
+ case failure
}
/// The type for Tulsi generator config documents.
@@ -271,7 +271,7 @@
LogMessage.postSyslog("Generate[FAIL]: \(timeTaken)",
details: errorInfo,
context: config.projectName)
- return .failure(errorInfo)
+ return .failure
}
deinit {
@@ -573,10 +573,10 @@
switch result {
case .success(let url):
return url
- case .failure(let errorInfo):
+ case .failure:
let msg = NSLocalizedString("Error_GeneralProjectGenerationFailure",
comment: "A general, critical failure during project generation.")
- LogMessage.postError(msg, details: errorInfo)
+ LogMessage.postError(msg)
return nil
}
}
diff --git a/src/Tulsi/main.swift b/src/Tulsi/main.swift
index 79e6ee7..c9eaee9 100644
--- a/src/Tulsi/main.swift
+++ b/src/Tulsi/main.swift
@@ -58,8 +58,8 @@
} catch HeadlessModeError.invalidBazelPath {
print("The path to the bazel binary is invalid")
exit(14)
- } catch HeadlessModeError.generationFailed(let reason) {
- print("Generation failed: \(reason)")
+ } catch HeadlessModeError.generationFailed() {
+ print("Xcode project generation failed")
exit(15)
} catch HeadlessModeError.invalidWorkspaceRootOverride {
print("The parameter given as the workspace root path is not a valid directory")
diff --git a/src/TulsiGenerator/BazelWorkspaceInfoExtractor.swift b/src/TulsiGenerator/BazelWorkspaceInfoExtractor.swift
index 9b72f21..d35a762 100644
--- a/src/TulsiGenerator/BazelWorkspaceInfoExtractor.swift
+++ b/src/TulsiGenerator/BazelWorkspaceInfoExtractor.swift
@@ -91,7 +91,7 @@
ruleEntryCache[label] = entry
}
} catch BazelAspectInfoExtractor.ExtractorError.buildFailed {
- throw BazelWorkspaceInfoExtractorError.aspectExtractorFailed("Bazel aspects could not be built")
+ throw BazelWorkspaceInfoExtractorError.aspectExtractorFailed("Bazel aspects could not be built.")
}
// Because certain label types are expanded by Bazel prior to aspect invocation (most notably
diff --git a/src/TulsiGenerator/XcodeProjectGenerator.swift b/src/TulsiGenerator/XcodeProjectGenerator.swift
index 3e1d218..a27ee8a 100644
--- a/src/TulsiGenerator/XcodeProjectGenerator.swift
+++ b/src/TulsiGenerator/XcodeProjectGenerator.swift
@@ -453,7 +453,7 @@
buildOptions: config.options[.BazelBuildOptionsDebug],
bepOption: config.options[.BEPSupportEnabled])
} catch BazelWorkspaceInfoExtractorError.aspectExtractorFailed(let info) {
- throw ProjectGeneratorError.labelAspectFailure("Failed to build aspects required for label resolution: \(info)")
+ throw ProjectGeneratorError.labelAspectFailure(info)
}
}