Set specific points where error modals should be displayed.
PiperOrigin-RevId: 207949814
diff --git a/src/Tulsi/ProjectEditorConfigManagerViewController.swift b/src/Tulsi/ProjectEditorConfigManagerViewController.swift
index bc105b7..54a70a7 100644
--- a/src/Tulsi/ProjectEditorConfigManagerViewController.swift
+++ b/src/Tulsi/ProjectEditorConfigManagerViewController.swift
@@ -178,6 +178,7 @@
let msg = NSLocalizedString("Error_GeneralCriticalFailure",
comment: "A general, critical failure without a more fitting descriptive message.")
LogMessage.postError(msg, details: errorInfo, context: projectDocument.projectName)
+ LogMessage.displayPendingErrors()
}
@@ -236,6 +237,7 @@
let msg = NSLocalizedString("Error_ConfigLoadFailed",
comment: "Error when a TulsiGeneratorConfig failed to be reloaded.")
LogMessage.postError(msg, details: errorInfo)
+ LogMessage.displayPendingErrors()
}
}
diff --git a/src/Tulsi/TulsiGeneratorConfigDocument.swift b/src/Tulsi/TulsiGeneratorConfigDocument.swift
index 0bece77..fced6dc 100644
--- a/src/Tulsi/TulsiGeneratorConfigDocument.swift
+++ b/src/Tulsi/TulsiGeneratorConfigDocument.swift
@@ -588,6 +588,7 @@
let msg = NSLocalizedString("Error_GeneralProjectGenerationFailure",
comment: "A general, critical failure during project generation.")
LogMessage.postError(msg, details: "Generator config is not fully populated.")
+ LogMessage.displayPendingErrors()
return nil
}
@@ -603,6 +604,7 @@
let msg = NSLocalizedString("Error_GeneralProjectGenerationFailure",
comment: "A general, critical failure during project generation.")
LogMessage.postError(msg)
+ LogMessage.displayPendingErrors()
return nil
}
}
diff --git a/src/Tulsi/TulsiProjectDocument.swift b/src/Tulsi/TulsiProjectDocument.swift
index a2ced92..1f3d453 100644
--- a/src/Tulsi/TulsiProjectDocument.swift
+++ b/src/Tulsi/TulsiProjectDocument.swift
@@ -292,6 +292,7 @@
let fmt = NSLocalizedString("Error_NoWORKSPACEFile",
comment: "Error when project does not have a valid Bazel WORKSPACE file at %1$@.")
LogMessage.postError(String(format: fmt, workspaceFile.path))
+ LogMessage.displayPendingErrors()
throw DocumentError.invalidWorkspace("Missing WORKSPACE file at \(workspaceFile.path)")
}
@@ -359,6 +360,7 @@
let fmt = NSLocalizedString("Error_ConfigDeleteFailed",
comment: "Error when a TulsiGeneratorConfig named %1$@ could not be deleted.")
LogMessage.postError(String(format: fmt, name), details: errorInfo)
+ LogMessage.displayPendingErrors()
}
}
}
diff --git a/src/Tulsi/XcodeProjectGenerationProgressViewController.swift b/src/Tulsi/XcodeProjectGenerationProgressViewController.swift
index 35424c9..756c7b1 100644
--- a/src/Tulsi/XcodeProjectGenerationProgressViewController.swift
+++ b/src/Tulsi/XcodeProjectGenerationProgressViewController.swift
@@ -144,6 +144,7 @@
// This should never actually happen and indicates an unexpected path through the UI.
LogMessage.postError(NSLocalizedString("Error_NoOutputFolder",
comment: "Error for a generation attempt without a valid target output folder"))
+ LogMessage.displayPendingErrors()
Thread.doOnMainQueue() {
completionHandler(nil)
}
@@ -185,6 +186,7 @@
let msg = NSLocalizedString("Error_GeneralProjectGenerationFailure",
comment: "A general, critical failure during project generation.")
LogMessage.postError(msg, details: errorInfo)
+ LogMessage.displayPendingErrors()
return nil
}
}
diff --git a/src/TulsiGenerator/TulsiNotifications.swift b/src/TulsiGenerator/TulsiNotifications.swift
index 4d98721..ba04552 100644
--- a/src/TulsiGenerator/TulsiNotifications.swift
+++ b/src/TulsiGenerator/TulsiNotifications.swift
@@ -64,9 +64,11 @@
userInfo: userInfo)
}
+ // Sends a notification to log an error and adds it to a list of errors that can be displayed
+ // through the UI. Note that the errors are only displayed through the UI when
+ // displayPendingErrors() is called.
public static func postError(_ message: String, details: String? = nil, context: String? = nil) {
postMessage(.Error, message: message, details: details, context: context)
- displayPendingErrors()
}
public static func postWarning(_ message: String, details: String? = nil, context: String? = nil) {