Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
case Error: {
errStr = e.message;
break;
}
default: {
errStr = e.toString();
break;
}
}
this.logger.Info(`Error while connecting to ${device.advertisement.localName}: ${errStr}`);
// We can't rethrow here, as this method is only called from an event
// handler, so just return;
return;
}
const bpProtocol = new protocolType(bpDevImpl);
const bpDevice = new ButtplugDevice(bpProtocol, bpDevImpl);
this.logger.Debug(`Initializing noble device ${device.advertisement.localName}`);
try {
await bpDevice.Initialize();
} catch (e) {
let errStr: string;
switch (e) {
case ButtplugDeviceException: {
errStr = e.errorMessage;
break;
}
case Error: {
errStr = e.message;
break;
}
default: {
errStr = e.toString();