Skip to content

Feat: New CALCAT exceptions

Karim Ahmed requested to merge feat/new_CALCAT_errors into master

Add new CALCAT exceptions to be able to differentiate between different error responses from CALCAT.

Description

Here I add transparency to CALCAT exceptions by adding more info to the error messages.

There are different exceptions for each module for calibration_client. As each module would share the same error codes (e.g. 404 {module_name} not found!) https://git.xfel.eu/search?search=not+found&group_id=11&project_id=242&scope=&search_code=true&snippets=false&repository_ref=master&nav_source=navbar

. An error exception is created for each module and the related API is using the corresponding module exception if success was False.

For example closest_ccv_by_time_by_condition is caught now for CalibrationData and SplitConditionCalibrationData. This decision enables the API user to define the optimal behavior for the code if there were no retrieved calibrations. Later pnCCD will be updated to use this. And all notebooks are already checking the retrieved dictionary and raising errors based on the expected CCVs.


The new exceptions:

This is the available one from before that displays the CALCAT response info.

  • class CalCatError(Exception):

These are used in calcat_interface.py and the check for 404 code otherwise. the response info is displayed by raising CALCATError

  • class CalibrationNotFoundError(Exception):
  • class CCVNotFoundError(Exception):
  • class DetectorNotFoundError(Exception):
  • class ParameterNotFoundError(Exception):
  • class PDUNotFoundError(Exception):

This one is not related to CALCAT but for the wrong calibration that is not part of DET_CalibrationData

  • class WrongCalibrationNameError(ValueError):

How Has This Been Tested?

Relevant Documents (optional)

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Test (additional or refactored tests)

Checklist:

Reviewers

@kluyvert @roscar @schmidtp

Edited by Karim Ahmed

Merge request reports