Handle ArgumentException in Bme680Sensor
This commit is contained in:
parent
8f9962c3b1
commit
47d22cae41
1 changed files with 12 additions and 3 deletions
|
@ -101,9 +101,11 @@ namespace NucuCar.Sensors.Environment
|
||||||
}
|
}
|
||||||
catch (System.IO.IOException e)
|
catch (System.IO.IOException e)
|
||||||
{
|
{
|
||||||
Logger?.LogError($"{DateTimeOffset.Now}:BME680 Sensor initialization FAIL.");
|
HandleInitializationException(e);
|
||||||
Logger?.LogTrace(e.Message);
|
}
|
||||||
CurrentState = SensorStateEnum.Error;
|
catch (ArgumentException e)
|
||||||
|
{
|
||||||
|
HandleInitializationException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,5 +171,12 @@ namespace NucuCar.Sensors.Environment
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bme680Sensor Object { get; }
|
public Bme680Sensor Object { get; }
|
||||||
|
|
||||||
|
private void HandleInitializationException(Exception e)
|
||||||
|
{
|
||||||
|
Logger?.LogError($"{DateTimeOffset.Now}:BME680 Sensor initialization FAIL.");
|
||||||
|
Logger?.LogDebug(e.Message);
|
||||||
|
CurrentState = SensorStateEnum.Error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue