From 2a0163de2ef11abdfbfa7fe5af09a44d2e911af3 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Mon, 13 May 2024 17:38:04 +0200
Subject: [PATCH] Geant4Handle: correct error message when casting does not
 work

---
 DDG4/src/Geant4Handle.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/DDG4/src/Geant4Handle.cpp b/DDG4/src/Geant4Handle.cpp
index 25a73c67c..0ca48825e 100644
--- a/DDG4/src/Geant4Handle.cpp
+++ b/DDG4/src/Geant4Handle.cpp
@@ -88,8 +88,9 @@ namespace dd4hep {
         if (ptr)  {
           return ptr;
         }
-        except("Geant4Handle", "Failed to convert object of type %s to handle of type %s!",
-               typ.first.c_str(),typ.second.c_str());
+        std::string _t = typeName(typeid(TYPE));
+        except("Geant4Handle", "Failed to convert object of type '%s' with name '%s' to handle of type '%s'!",
+               typ.first.c_str(),typ.second.c_str(),_t.c_str());
       }
       except("Geant4Handle", "Failed to create object of type %s!", typ.first.c_str());
       return 0;
-- 
GitLab