pvStatusToException function

dynamic pvStatusToException(
  1. PvStatus pvStatus,
  2. String errorMessage
)

Implementation

pvStatusToException(PvStatus pvStatus, String errorMessage) {
  switch (pvStatus) {
    case PvStatus.OUT_OF_MEMORY:
      throw new PvStatusOutOfMemoryError(errorMessage);
    case PvStatus.IO_ERROR:
      throw new PvStatusIoError(errorMessage);
    case PvStatus.INVALID_ARGUMENT:
      throw new PvStatusInvalidArgumentError(errorMessage);
    case PvStatus.STOP_ITERATION:
      throw new PvStatusStopIterationError(errorMessage);
    case PvStatus.KEY_ERROR:
      throw new PvStatusKeyError(errorMessage);
    case PvStatus.INVALID_STATE:
      throw new PvStatusInvalidStateError(errorMessage);
    default:
      print("Unmapped error code: $pvStatus");
      throw new PvError(errorMessage);
  }
}