Added error logging to CapDevice.cs