forked from shadowfacts/Tusker
parent
6c5909c800
commit
4401503b85
|
@ -48,7 +48,12 @@ public final class Status: StatusProtocol, Decodable, Sendable {
|
||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
self.id = try container.decode(String.self, forKey: .id)
|
self.id = try container.decode(String.self, forKey: .id)
|
||||||
self.uri = try container.decode(String.self, forKey: .uri)
|
self.uri = try container.decode(String.self, forKey: .uri)
|
||||||
self.url = try container.decodeIfPresent(WebURL.self, forKey: .url)
|
do {
|
||||||
|
self.url = try container.decodeIfPresent(WebURL.self, forKey: .url)
|
||||||
|
} catch {
|
||||||
|
let s = (try? container.decode(String.self, forKey: .url)) ?? "<failed to decode string>"
|
||||||
|
throw DecodingError.dataCorruptedError(forKey: .url, in: container, debugDescription: "Could not decode URL '\(s)', reason: \(String(describing: error))")
|
||||||
|
}
|
||||||
self.account = try container.decode(Account.self, forKey: .account)
|
self.account = try container.decode(Account.self, forKey: .account)
|
||||||
self.inReplyToID = try container.decodeIfPresent(String.self, forKey: .inReplyToID)
|
self.inReplyToID = try container.decodeIfPresent(String.self, forKey: .inReplyToID)
|
||||||
self.inReplyToAccountID = try container.decodeIfPresent(String.self, forKey: .inReplyToAccountID)
|
self.inReplyToAccountID = try container.decodeIfPresent(String.self, forKey: .inReplyToAccountID)
|
||||||
|
|
Loading…
Reference in New Issue