From b37008a515c7d9f6eb159449bb880eb2dcb65e9d Mon Sep 17 00:00:00 2001 From: rmcan <45202979+rmcan@users.noreply.github.com> Date: Wed, 22 Nov 2023 04:27:46 -0800 Subject: [PATCH] fixes #29 --- swiftsky/api/bsky/actorgetPreferences.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/swiftsky/api/bsky/actorgetPreferences.swift b/swiftsky/api/bsky/actorgetPreferences.swift index cf1584c..52cdb6b 100644 --- a/swiftsky/api/bsky/actorgetPreferences.swift +++ b/swiftsky/api/bsky/actorgetPreferences.swift @@ -9,7 +9,7 @@ enum ActorDefsPreferencesElem: Codable { case adultcontent(ActorDefsAdultContentPref) case contentlabel(ActorDefsContentLabelPref) case savedfeeds(ActorDefsSavedFeedsPref) - + case none enum CodingKeys: String, CodingKey { case type = "$type" } @@ -24,7 +24,7 @@ enum ActorDefsPreferencesElem: Codable { case "app.bsky.actor.defs#savedFeedsPref": self = try .savedfeeds(.init(from: decoder)) default: - throw NSError(domain: "", code: 0, userInfo: [NSLocalizedDescriptionKey : "ActorDefsPreferencesElem decode failed"]) + self = .none } } func encode(to encoder: Encoder) throws { @@ -36,6 +36,8 @@ enum ActorDefsPreferencesElem: Codable { try container.encode(value) case .savedfeeds(let value): try container.encode(value) + default: + break } } var feeds: ActorDefsSavedFeedsPref? {