diff --git a/cal_tools/cal_tools/tools.py b/cal_tools/cal_tools/tools.py
index 435c998cae18918f13fd0038450d56fa171df7a6..d5477e9f6037d2005d66aa5b9a5cba02628bd67a 100644
--- a/cal_tools/cal_tools/tools.py
+++ b/cal_tools/cal_tools/tools.py
@@ -238,7 +238,7 @@ already_printed = {}
 def get_from_db(device, constant, condition, empty_constant,
                 cal_db_interface, creation_time=None,
                 verbosity=1, timeout=30000, ntries=7, meta_only=True,
-                version_info=False):
+                version_info=False, doraise=False):
     """
     Return calibration constants and metadata requested from CalDB
 
@@ -253,8 +253,10 @@ def get_from_db(device, constant, condition, empty_constant,
     ntries is set to 7 so that if the timeout started at 30s last timeout
     will be ~ 1h.
     :param ntries: number of tries to contact the database
-    :param meta_only: Retrieve only metadata via ZMQ. Constants are taken
-        directly from the h5 file on maxwell.
+    :param meta_only: (bool) Retrieve only metadata via ZMQ. Constants are
+        taken directly from the h5 file on maxwell.
+    :param version_info: (bool) to show the info for the retrieved Constant
+    :param doraise: (bool) if True raise errors during communication with DB.
     :return: Calibration constant, metadata
     """
     from iCalibrationDB import ConstantMetaData, Versions
@@ -292,6 +294,8 @@ def get_from_db(device, constant, condition, empty_constant,
                 ntries -= 1
                 timeout *= 2
                 sleep(np.random.randint(30))
+                if ntries == 0 and doraise:
+                    raise
             except Exception as e:
                 if verbosity > 0:
                     print(e)
@@ -299,7 +303,9 @@ def get_from_db(device, constant, condition, empty_constant,
                     ntries -= 1
                 else:
                     ntries = 0
-                    break
+                if ntries == 0 and doraise:
+                    raise RuntimeError(f'{e}')
+
 
         if ntries > 0:
             if verbosity > 0:
@@ -332,7 +338,7 @@ def send_to_db(device, constant, condition, file_loc,
     :param ntries: number of tries to contact the database,
     ntries is set to 7 so that if the timeout started at 30s last timeout
     will be ~ 1h.
-    :param doraise: if True raise errors during communication with DB
+    :param doraise: (bool) if True raise errors during communication with DB
     """
     from iCalibrationDB import ConstantMetaData, Versions
     import zmq
@@ -371,7 +377,7 @@ def send_to_db(device, constant, condition, file_loc,
                 else:
                     ntries = 0
                 if ntries == 0 and doraise:
-                    raise
+                    raise RuntimeError(f'{e}')
 
         if ntries > 0:
             if verbosity > 0:
@@ -406,6 +412,12 @@ def get_constant_from_db_and_time(device, constant, condition, empty_constant,
                           cal_db_interface, creation_time,
                           int(print_once), timeout, ntries)
     if m:
-        return data, m.calibration_constant_version.begin_at
+        if m.comm_db_success:
+            return data, m.calibration_constant_version.begin_at
+        else:
+            # retun none for injection time if communication with db failed.
+            # reasons (no constant or condition found,
+            # or network problem)
+            return data, None
     else:
         return data, None
diff --git a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
index 3d34b7934b7a7b73899a8fe4ed869dbbdfbfbdf3..2bb9fdeae0b184a8ea8bd260cd0f4a32ad11316d 100644
--- a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
+++ b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
@@ -641,9 +641,6 @@
     "        for key, item in when.items():\n",
     "            if hasattr(item, 'strftime'):\n",
     "                item = item.strftime('%y-%m-%d %H:%M')\n",
-    "            # If constant retrieval is crashed\n",
-    "            else:\n",
-    "                item = 'None'\n",
     "            when[key] = item\n",
     "            print('{:.<12s}'.format(key), item)\n",
     "            \n",