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