Message: How to catch G4Exceptions ? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question How to catch G4Exceptions ? 

Forum: Run Management
Date: Nov 22, 06:52
From: Julien Bolmont <Julien Bolmont>

Hi,

I'd like to know a clean way to properly catch a G4Exception. Namely, I use GDML geometries and I'd like to catch the exception which is thrown when validation is on and when I have no network connexion. This exception leads to the following message :

G4GDML: VALIDATION ERROR! fatal error during schema scan at line: 2

-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : InvalidRead
      issued by : G4GDMLRead::Read()
ERROR - Empty document or unable to validate schema!
        Check Internet connection is ON in case of schema
        validation enabled and location defined as URL in
        the GDML file - geometries/thin_cylinder_vacuum_geometry.gdml - being imported!
        Otherwise, verify GDML schema server is reachable!
*** Fatal Exception *** core dump ***
 **** Track information is not available at this moment
 **** Step information is not available at this moment

-------- EEEE -------- G4Exception-END --------- EEEE -------

*** G4Exception: Aborting execution ***

My idea is to put the call to G4GDMLParser::Read() into a "try" block and then in the "catch" block, try to Read the file again, but with schema validation turned off.

I do not use exceptions very often so I don't really know how to use G4Exceptions.

Any help would be really appreciated !

Thanks a lot, Julien

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Feedback: Re: How to catch G4Exceptions ?   (Jonathan Madsen - Feb 04, 18:19)
(_ None: Re: How to catch G4Exceptions ?   (Tom Roberts - Feb 04, 20:31)
 Add Message Add Message
to: "How to catch G4Exceptions ?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]