Browse Source

better error msg for unknown components

Sebastian Bittrich 3 năm trước cách đây
mục cha
commit
62a58facb2
1 tập tin đã thay đổi với 3 bổ sung0 xóa
  1. 3 0
      src/mol-io/writer/mol/encoder.ts

+ 3 - 0
src/mol-io/writer/mol/encoder.ts

@@ -26,6 +26,9 @@ export class MolEncoder extends LigandEncoder {
 
         const atomMap = this.componentAtomData.entries.get(name)!;
         const bondMap = this.componentBondData.entries.get(name)!;
+        // happens for unknown ligands like UNL
+        if (!atomMap) throw Error(`Component ${name} is not registered in the Chemical Component Dictionary`);
+
         let bondCount = 0;
         let chiral = false;