Log cached infra JSON when unable to parse

This commit is contained in:
Davide De Rosa 2019-04-28 21:33:08 +02:00
parent 125c6a7d67
commit b714f8acd9
1 changed files with 6 additions and 1 deletions

View File

@ -106,7 +106,12 @@ public class InfrastructureFactory {
guard let data = try? Data(contentsOf: entry) else {
continue
}
guard let infra = try? decoder.decode(Infrastructure.self, from: data) else {
let infra: Infrastructure
do {
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)!)")
continue
}