]> Creatis software - creaBruker.git/blobdiff - appli/testBruker2Dicom/testBruker2Dicom.cxx
Throw and catch exception *everywhere* (hope it's enough!)
[creaBruker.git] / appli / testBruker2Dicom / testBruker2Dicom.cxx
index b20536ee78fb32d3096e6a9c7a4cf7ff1e598ab2..ba0403630d122d634d8551d97cab0812136f73e9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: testBruker2Dicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/05/18 16:33:20 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2009/06/19 15:51:44 $
+  Version:   $Revision: 1.5 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -31,6 +31,7 @@
 #include "gdcmArgMgr.h"
 
 #include "bruker2dicom.h"
+#include "brukerexception.h"
 
 // ===================================================================================================
 /**
@@ -152,7 +153,7 @@ int main(int argc, char *argv[])
 // b2d.day : unused  ...
    b2d.day          = am->ArgMgrGetString("day", "You_forget_the_Day");
       
-   delete am;  // we don't need Argument Manager any longer
+ delete am;  // we don't need Argument Manager any longer  
 
    // ----------- End Arguments Manager ---------
    
@@ -167,10 +168,22 @@ int main(int argc, char *argv[])
    try {
       b2d.Execute();
    }
-   catch (int)
+   catch (int i)
    {
-      std::cout << "Exception was thrown  :-( " << std::endl;
+      std::cout << "Exception was thrown  (" << i << ") " << std::endl;
    }
+   /*
+   catch (std::exception& e) {
+   std::cerr << "ERREUR: " << e.what() << "expected length: " << e.getExpectedLgt()
+             << " Found : " << e.getFoundLgt() << std::endl;
+   }
+  */
+
+   catch (BrukerHopelessException &e)
+   {
+      std::cout << "And Hopless Exception was thrown  (" << e.what() << ") " << std::endl;
+   }
+
 
 }