Catch exception when instantiating USB camera if camera isn't present

Change-Id: I7f81c26619e55b49a0d205bdefe5fcd8adc7c3e2
This commit is contained in:
Joe Ross
2015-03-22 11:24:55 -07:00
parent 0e46592ad1
commit 0dffbd8634

View File

@@ -164,9 +164,14 @@ public class CameraServer {
* The name of the camera interface (e.g. "cam1")
*/
public void startAutomaticCapture(String cameraName) {
USBCamera camera = new USBCamera(cameraName);
camera.openCamera();
startAutomaticCapture(camera);
try {
USBCamera camera = new USBCamera(cameraName);
camera.openCamera();
startAutomaticCapture(camera);
}
catch (VisionException ex) {
DriverStation.reportError("Error when starting the camera: " + cameraName + " " + ex.getMessage(), true);
}
}
public synchronized void startAutomaticCapture(USBCamera camera) {