diff --git a/WatchFaceDumper/Document.swift b/WatchFaceDumper/Document.swift index 9bb2d05..e53d4b7 100644 --- a/WatchFaceDumper/Document.swift +++ b/WatchFaceDumper/Document.swift @@ -40,7 +40,7 @@ class Document: NSDocument { } } catch { NSLog("%@", "error reading \(fileWrapper): \(String(describing: error))") - throw error + throw NSError(domain: (error as NSError).domain,code: (error as NSError).code, userInfo: (error as NSError).userInfo ※ {$0[NSLocalizedFailureReasonErrorKey] = "\n\nError Report:\n" + String(describing: error)}) } } diff --git a/WatchFaceDumper/Watchface.swift b/WatchFaceDumper/Watchface.swift index 8d6d731..962a19b 100644 --- a/WatchFaceDumper/Watchface.swift +++ b/WatchFaceDumper/Watchface.swift @@ -49,7 +49,10 @@ struct Watchface { self = .circularSmallSimpleImage(t) return } - throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: [], debugDescription: "unknown ComplicationTemplate type")) + + + let anyTemplate = try? CLKComplicationTemplateAny(from: decoder) + throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: [], debugDescription: "unknown ComplicationTemplate type: \(anyTemplate?.class ?? "(unknown structure)")")) } func encode(to encoder: Encoder) throws { @@ -60,6 +63,10 @@ struct Watchface { case .circularSmallSimpleImage(let t): try t.encode(to: encoder) } } + + private struct CLKComplicationTemplateAny: Codable { + var `class`: String + } } enum CLKTextProvider: Codable {