Exceptions

Module contains all exception class that are used in this package.

NetDICOMError serves as base exception class.

The class hierarchy for exceptions is:

Exception
+– NetDICOMError
+– ClassNotSupportedError
+– PDUProcessingError
+– DIMSEProcessingError
+– AssociationError
+– AssociationRejectedError
+– AssociationReleasedError
+– AssociationAbortedError
+– EventHandlingError
exception netdicom2.exceptions.NetDICOMError(*args, **kwargs)

Base class for all library specific exceptions exception.

exception netdicom2.exceptions.ClassNotSupportedError(*args, **kwargs)

Raised when requested SOP Class is not supported by application entity.

exception netdicom2.exceptions.PDUProcessingError(*args, **kwargs)

Raised when error occurs while processing PDU.

Can be raised, for example, when PDU failed to decode from data.

exception netdicom2.exceptions.DIMSEProcessingError(*args, **kwargs)

Raised when error occurs while processing DIMSE.

Can be raised, for example, while DIMSEProvider tries to decode DIMSE from fragments.

exception netdicom2.exceptions.AssociationError(*args, **kwargs)

Base association error.

This error shall not be raised directly, instead its more specialized sub-classes are raised in appropriate situations.

exception netdicom2.exceptions.AssociationRejectedError(result, source, diagnostic, *args, **kwargs)

Raised when remote application entity has rejected requested association.

Exception has 3 instance attributes to indicate why association was rejected:

  • Result,
  • Source,
  • Reason/Diag

as described in PS 3.8 (9.3.4 A-ASSOCIATE-RJ PDU STRUCTURE).

For convenience the following documentation has quotes from DICOM standard (2011) explaining possible values of the exception attributes and their meaning.

Parameters:
  • result – 1 - rejected-permanent or 2 - rejected-transient
  • source

    This Source field shall contain an integer value encoded as an unsigned binary number. One of the following values shall be used:

    • 1 - DICOM UL service-user
    • 2 - DICOM UL service-provider (ACSE related function)
    • 3 - DICOM UL service-provider (Presentation related function)
  • diagnostic

    This field shall contain an integer value encoded as an unsigned binary number. If the Source field has the value (1) DICOM UL service-user, it shall take one of the following:

    • 1 - no-reason-given
    • 2 - application-context-name-not-supported
    • 3 - calling-AE-title-not-recognized
    • 4-6 - reserved
    • 7 - called-AE-title-not-recognized
    • 8-10 - reserved

    If the Source field has the value (2) DICOM UL service provided (ACSE related function), it shall take one of the following:

    • 1 - no-reason-given
    • 2 - protocol-version-not-supported

    If the Source field has the value (3) DICOM UL service provided (Presentation related function), it shall take one of the following:

    • 0 - reserved
    • 1 - temporary-congestion
    • 2 - local-limit-exceeded
    • 3-7 - reserved
exception netdicom2.exceptions.AssociationReleasedError(*args, **kwargs)

Raised when remote application entity has released active association.

exception netdicom2.exceptions.AssociationAbortedError(source, reason_diag, *args, **kwargs)

Raised when remote application entity has aborted association.

Parameters:
  • source
  • reason_diag
exception netdicom2.exceptions.TimeoutError(*args, **kwargs)

Raised if timeout occurred when expected PDU from DUL.

exception netdicom2.exceptions.EventHandlingError(*args, **kwargs)

This exception is not raised by the package itself.

This exception should be raised by the user when sub-classing AE class and implementing custom event handlers. This exception would indicate that the AE failed to process received event. Service classes expect this exception and would act accordingly. If event handler would raise any other exception (not a sub-class of this one), service class won’t handle it.