Again with the types
This commit is contained in:
@@ -535,7 +535,27 @@ public class Product: Codable, ObjectDebugger {
|
||||
lastImageDatesTags = try container.decodeIfPresent([String].self, forKey: .lastImageDatesTags)
|
||||
lastImageT = try container.decodeIfPresent(Float.self, forKey: .lastImageT)
|
||||
lastModifiedBy = try container.decodeIfPresent(String.self, forKey: .lastModifiedBy)
|
||||
lastModifiedT = try container.decodeIfPresent(Float.self, forKey: .lastModifiedT)
|
||||
if container.contains(.lastModifiedT) {
|
||||
if try container.decodeNil(forKey: .maxImgid) {
|
||||
lastModifiedT = nil
|
||||
} else {
|
||||
if let floatValue = try? container.decode(Float.self, forKey: .lastModifiedT) {
|
||||
lastModifiedT = floatValue
|
||||
} else if let stringValue = try? container.decode(String.self, forKey: .lastModifiedT) {
|
||||
lastModifiedT = Float(stringValue)
|
||||
}else {
|
||||
// If decoding as both Float and String fails, handle the error accordingly
|
||||
throw DecodingError.dataCorruptedError(
|
||||
forKey: .lastModifiedT,
|
||||
in: container,
|
||||
debugDescription: "Unable to decode lastModifiedT"
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
lastModifiedT = nil
|
||||
}
|
||||
lc = try container.decodeIfPresent(String.self, forKey: .lc)
|
||||
link = try container.decodeIfPresent(String.self, forKey: .link)
|
||||
linkDebugTags = try container.decodeIfPresent([String].self, forKey: .linkDebugTags)
|
||||
|
||||
Reference in New Issue
Block a user