فهرست منبع

better error msg for unknown components

Sebastian Bittrich 3 سال پیش
والد
کامیت
62a58facb2
1فایلهای تغییر یافته به همراه3 افزوده شده و 0 حذف شده
  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;