Esempio n. 1
0
        public static void MmalCheck(MmalStatusEnum status, string message)
        {
            if (status == MmalStatusEnum.MmalSuccess)
            {
                return;
            }

            throw status switch
                  {
                      MmalStatusEnum.MmalEnomem => new MmalNoMemoryException(message),
                      MmalStatusEnum.MmalEnospc => new MmalNoSpaceException(message),
                      MmalStatusEnum.MmalEinval => new MmalInvalidException(message),
                      MmalStatusEnum.MmalEnosys => new MmalNotImplementedException(message),
                      MmalStatusEnum.MmalEnoent => new MmalInvalidDirectoryException(message),
                      MmalStatusEnum.MmalEnxio => new MmalInvalidDeviceException(message),
                      MmalStatusEnum.MmalEio => new MmalIoException(message),
                      MmalStatusEnum.MmalEspipe => new MmalIllegalSeekException(message),
                      MmalStatusEnum.MmalEcorrupt => new MmalCorruptException(message),
                      MmalStatusEnum.MmalEnotready => new MmalComponentNotReadyException(message),
                      MmalStatusEnum.MmalEconfig => new MmalComponentNotConfiguredException(message),
                      MmalStatusEnum.MmalEisconn => new MmalPortConnectedException(message),
                      MmalStatusEnum.MmalEnotconn => new MmalPortNotConnectedException(message),
                      MmalStatusEnum.MmalEagain => new MmalResourceUnavailableException(message),
                      MmalStatusEnum.MmalEfault => new MmalBadAddressException(message),
                      _ => new MmalException(status, $"Unknown error occurred. {message}"),
                  };
        }
Esempio n. 2
0
 public MmalException(MmalStatusEnum status, string message) : base($"Status: {status}. Message: {message}")
 {
 }