From 34c03f5f559a0c419ba0c4e4584a47846b8452a9 Mon Sep 17 00:00:00 2001 From: Alexander Rose <alex.rose@rcsb.org> Date: Wed, 6 Feb 2019 13:19:29 -0800 Subject: [PATCH] error handling when _atom_site.ihm_model_id is unavailable --- src/mol-model/structure/model/formats/mmcif.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mol-model/structure/model/formats/mmcif.ts b/src/mol-model/structure/model/formats/mmcif.ts index d0684dcb4..971eebd0a 100644 --- a/src/mol-model/structure/model/formats/mmcif.ts +++ b/src/mol-model/structure/model/formats/mmcif.ts @@ -270,6 +270,10 @@ async function readIHM(ctx: RuntimeContext, format: mmCIF_Format, formatData: Fo const { ihm_model_list } = format.data; const entities: Entities = { data: format.data.entity, getEntityIndex: Column.createIndexer(format.data.entity.id) }; + if (!format.data.atom_site.ihm_model_id.isDefined) { + throw new Error('expected _atom_site.ihm_model_id to be defined') + } + // TODO: will IHM require sorting or will we trust it? const atom_sites = splitTable(format.data.atom_site, format.data.atom_site.ihm_model_id); const sphere_sites = splitTable(format.data.ihm_sphere_obj_site, format.data.ihm_sphere_obj_site.model_id); -- GitLab