TeraGeneratedRuntimeFailure.swift (823B)
1 import Foundation 2 import TeraKitBindings 3 4 enum TeraGeneratedRuntimeFailure { 5 static func from(_ error: Error) -> TeraRuntimeFailure { 6 if case let TeraAppError.Failure(report) = error { 7 return TeraRuntimeFailure( 8 schemaVersion: report.schemaVersion, 9 code: report.code, 10 category: report.category, 11 retryable: report.retryable, 12 recoveryActions: report.recoveryActions, 13 operationID: report.operationId, 14 capabilityID: report.capabilityId, 15 safeMessage: report.safeMessage 16 ) 17 } 18 if let failure = error as? TeraRuntimeFailure { 19 return failure 20 } 21 return .local( 22 operation: "generated.runtime", 23 code: "ios.generated_runtime.unexpected", 24 safeMessage: "The Tera runtime could not complete the operation." 25 ) 26 } 27 }