This commit is contained in:
parent
bf721eddf6
commit
b43b59e526
@ -188,7 +188,7 @@ export class BaseHub extends EventEmitter {
|
||||
if (portId !== undefined) {
|
||||
return this._attachedDevices[portId];
|
||||
} else {
|
||||
throw new Error(`Port ${portName} does not exist on this hub type`);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,19 +95,11 @@ export class LPF2Hub extends BaseHub {
|
||||
|
||||
|
||||
public createVirtualPort (firstPortName: string, secondPortName: string) {
|
||||
const firstPortId = this._portMap[firstPortName];
|
||||
if (!firstPortId) {
|
||||
throw new Error(`Port ${firstPortName} does not exist on this hub`);
|
||||
}
|
||||
const secondPortId = this._portMap[secondPortName];
|
||||
if (!secondPortId) {
|
||||
throw new Error(`Port ${secondPortName} does not exist on this hub`);
|
||||
}
|
||||
const firstDevice = this._getDeviceByPortId(firstPortId);
|
||||
const firstDevice = this.getDeviceAtPort(firstPortName);
|
||||
if (!firstDevice) {
|
||||
throw new Error(`Port ${firstPortName} does not have an attached device`);
|
||||
}
|
||||
const secondDevice = this._getDeviceByPortId(secondPortId);
|
||||
const secondDevice = this.getDeviceAtPort(secondPortName);
|
||||
if (!secondDevice) {
|
||||
throw new Error(`Port ${secondPortName} does not have an attached device`);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user