Explorar o código

better error msg for unknown components

Sebastian Bittrich %!s(int64=3) %!d(string=hai) anos
pai
achega
62a58facb2
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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;