Take no risks with unwrapped optionals
This commit is contained in:
parent
c6f154ec18
commit
e6d67ac9f6
|
@ -111,7 +111,9 @@ public class InfrastructureFactory {
|
|||
infra = try decoder.decode(Infrastructure.self, from: data)
|
||||
} catch let e {
|
||||
log.warning("Unable to load infrastructure \(entry.lastPathComponent): \(e)")
|
||||
log.warning("\(String(data: data, encoding: .utf8)!)")
|
||||
if let json = String(data: data, encoding: .utf8) {
|
||||
log.warning(json)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ public struct InfrastructurePreset: Codable {
|
|||
for entry in external {
|
||||
rawExternal[entry.key.rawValue] = entry.value
|
||||
}
|
||||
try container.encodeIfPresent(rawExternal, forKey: .external)
|
||||
try container.encode(rawExternal, forKey: .external)
|
||||
}
|
||||
|
||||
var cfgContainer = container.nestedContainer(keyedBy: ConfigurationKeys.self, forKey: .configuration)
|
||||
|
|
Loading…
Reference in New Issue