Skip to content

Latest commit

 

History

History
12 lines (10 loc) · 1.02 KB

exception-handling.md

File metadata and controls

12 lines (10 loc) · 1.02 KB

Exception handling Guidelines

The Dicom server code follows below pattern for raising exceptions

  • All exceptions thrown in the dicom-server code inherit from base type DicomServerException.
  • All user input validation errors throw a derived exception from ValidationException.
  • Internal classes use Ensure library to validate input. Ensure library throws .Net Argument*Exception.
  • Exceptions from dependent libraries like fo-dicom are caught and wrapped in exception inherited from DicomServerException.
  • Exceptions from dependent services libraries like Azure storage blob are caught and wrapped in exception inherited from DicomServerException.

The Dicom server code follows below pattern for handling exceptions

  • All DicomServerExceptions are handled in middleware ExceptionHandlingMiddleware. These exceptions are mapped to the right status code and response body.
  • All unexpected exceptions are logged and mapped to 500 server error.