←Select platform

DicomException Constructor(string,Exception)

Summary
Initializes a new instance of the DicomException class with the specified error message, its Code set to DicomExceptionCode.Success and a reference to the inner exception that is the cause of this exception.
Syntax
C#
C++/CLI
Java
public DicomException( 
   string message, 
   Exception inner 
) 
public DicomException(String message, RuntimeException inner) 
public: 
DicomException(  
   String^ message, 
   Exception^ inner 
) 

Parameters

message
The error message that explains the reason for the exception.

inner
The exception that is the cause of the current exception. If the innerException parameter is not a null reference (Nothing in VB), the current exception is raised in a catch block that handles the inner exception.

Example
C#
using Leadtools; 
using Leadtools.Dicom; 
 
 
public void TestLoadDicomDataset() 
{ 
   string dicomFileName = Path.Combine(LEAD_VARS.ImagesDir, "SomeBadFileName.dcm"); 
   //Make sure to initialize the DICOM engine, this needs to be done only once  
   //In the whole application 
   DicomEngine.Startup(); 
   using (DicomDataSet ds = new DicomDataSet()) 
   { 
      try 
      { 
         ds.Load(dicomFileName, DicomDataSetLoadFlags.None); 
      } 
      catch (DicomException ex) 
      { 
         //LEADTOOLS Dicom Error (the file can't be opened) 
         if (ex.Code == DicomExceptionCode.Open) 
            Console.WriteLine(string.Format("File {0} can't be opened", dicomFileName)); 
         else 
         { 
            //Some other LEADTOOLS Dicom Error 
            Console.WriteLine(string.Format("Could not load the file {0}.{1}Dicom error code: {2}{1}Message: {3}", dicomFileName, Environment.NewLine, ex.Code, ex.Message)); 
         } 
      } 
      catch (Exception ex) 
      { 
         // Other errors 
         Console.WriteLine(string.Format("Could not load the file {0}.{1}{2}", dicomFileName, Environment.NewLine, ex.Message)); 
      } 
   } 
   DicomEngine.Shutdown(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.8.20
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.