Catch error for debugging
This commit is contained in:
parent
f858f2e380
commit
e90bf7c9db
@ -92,9 +92,13 @@ import UIKit
|
||||
}
|
||||
|
||||
/// Convenience setter for legacy files
|
||||
public static func set(navigationController: UINavigationController, navigationJSON: [String: Any], viewController: UIViewController) {
|
||||
let moleculeName = ModelRegistry.getType(for: navigationJSON.stringForkey(KeyMoleculeName), with: MoleculeModelProtocol.self)
|
||||
guard let barModel = try? moleculeName?.decode(jsonDict: navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else { return }
|
||||
public static func set(navigationController: UINavigationController, navigationJSON: [String: Any], viewController: UIViewController) throws {
|
||||
guard let moleculeName = ModelRegistry.getType(for: navigationJSON.stringForkey(KeyMoleculeName), with: MoleculeModelProtocol.self) else {
|
||||
throw ModelRegistry.Error.keyNotFound
|
||||
}
|
||||
guard let barModel = try moleculeName.decode(jsonDict: navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else {
|
||||
throw ModelRegistry.Error.decoderOther(message: "Model not a bar model")
|
||||
}
|
||||
set(navigationController: navigationController, navigationItemModel: barModel, viewController: viewController)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user