Prevent double logging and double error popup.
This commit is contained in:
parent
6c0f0993a0
commit
289a31af24
@ -155,7 +155,7 @@ import MVMCore
|
||||
case .decoderErrorModelNotMapped(let identifier, let codingKey, let codingPath) where identifier != nil && codingKey != nil && codingPath != nil:
|
||||
return "Error parsing template. Model identifier \"\(identifier!)\" is not mapped for \"\(codingKey!.stringValue)\" @ \(codingPath!.map { return $0.stringValue })"
|
||||
|
||||
case .decoderErrorObjectNotPresent(let codingKey, codingPath: let codingPath):
|
||||
case .decoderErrorObjectNotPresent(let codingKey, let codingPath):
|
||||
return "Error parsing template. Required model \"\(codingKey.stringValue)\" was not found @ \(codingPath.map { return $0.stringValue })"
|
||||
|
||||
default:
|
||||
@ -475,6 +475,7 @@ import MVMCore
|
||||
|
||||
open func handleAction(error: Error, model: ActionModelProtocol, additionalData: [AnyHashable : Any]?, delegateObject: DelegateObject?) {
|
||||
let errorObject = MVMCoreErrorObject.createErrorObject(for: error, location: MVMCoreActionHandler.getErrorLocation(with: delegateObject?.actionDelegate, actionType: model.actionType))!
|
||||
errorObject.silentError = (error as? MVMCoreErrorObject)?.silentError ?? false // Prefer incoming settings, then default to loud.
|
||||
MVMCoreUIActionHandler.shared()?.defaultHandleActionError(errorObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@ import SafariServices
|
||||
open override func defaultHandleActionError(_ error: MVMCoreErrorObject, additionalData: [AnyHashable : Any]?) {
|
||||
super.defaultHandleActionError(error, additionalData: additionalData)
|
||||
guard !error.silentError else { return }
|
||||
error.silentError = true // Silence if this error is triggered again. (Legacy action handler flow.)
|
||||
Task(priority: .userInitiated) { @MainActor in
|
||||
let alertObject = MVMCoreAlertObject.init(popupAlertWithError: error, isGreedy: false)!
|
||||
MVMCoreAlertHandler.shared()?.showAlert(with: alertObject)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user