From 86eb4b1d2edc57445ff0b9752ef1603c9ae5bdd8 Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Sat, 30 Dec 2023 17:07:14 +0100
Subject: [PATCH] mmcif writer: clarify error message for negative residue
 numbers

Only relevant for resnum based alignments, i.e. enabled mmcif_conform flag
---
 modules/io/src/mol/mmcif_writer.cc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/modules/io/src/mol/mmcif_writer.cc b/modules/io/src/mol/mmcif_writer.cc
index 230e4e359..ecd5ba7d5 100644
--- a/modules/io/src/mol/mmcif_writer.cc
+++ b/modules/io/src/mol/mmcif_writer.cc
@@ -713,7 +713,13 @@ namespace {
       for(auto res: res_list) {
         int num = res.GetNumber().GetNum();
         if(num < 1) {
-          throw "asdf";
+          std::stringstream ss;
+          ss << "Try to construct mmCIF entity from residues using resnum ";
+          ss << "based alignments. Negative residue numbers are not allowed ";
+          ss << "in this case. Got: " << num << " in residue " << res;
+          ss << ". You may set mmcif_conform flag to False to write something ";
+          ss << "but be aware of the consequences...";
+          throw ost::io::IOException(ss.str());
         }
         res_mon_ids.push_back(res.GetName());
         resnums.push_back(num);
-- 
GitLab