Use template strings where needed.

This commit is contained in:
László Monda
2016-03-30 22:17:07 +02:00
parent 45dc8a520f
commit d2f3ec62f0
8 changed files with 12 additions and 12 deletions

View File

@@ -25,7 +25,7 @@ class DualRoleKeystrokeAction extends KeyAction implements Serializable<DualRole
set longPressAction(value) {
if (!DualRoleKeystrokeAction.isDualRoleKeystrokeActionValid(value)) {
throw 'Invalid DualRoleKeystrokeAction.longPressAction: ${value}';
throw `Invalid DualRoleKeystrokeAction.longPressAction: ${value}`;
}
this._longPressAction = value;
}

View File

@@ -23,7 +23,7 @@ class KeyAction {
case NoneAction.keyActionTypeString:
return new NoneAction().fromJsObject(jsObject);
default:
throw 'Invalid KeyAction.keyActionType: "${jsObject.actionType}"';
throw `Invalid KeyAction.keyActionType: "${jsObject.actionType}"`;
}
}
@@ -39,20 +39,20 @@ class KeyAction {
case KeyActionId.NoneAction:
return new NoneAction().fromBinary(buffer);
default:
throw 'Invalid KeyAction first byte "${keyActionFirstByte}"';
throw `Invalid KeyAction first byte "${keyActionFirstByte}"`;
}
}
assertKeyActionType(jsObject: any, keyActionTypeString: string, classname: string) {
if (jsObject.keyActionType !== keyActionTypeString) {
throw 'Invalid ${classname}.id: ${jsObject.keyActionType}';
throw `Invalid ${classname}.keyActionType: ${jsObject.keyActionType}`;
}
}
readAndAssertKeyActionId(buffer: UhkBuffer, keyActionIdParam: KeyActionId, classname: string) {
let readKeyActionId = buffer.readUInt8();
if (readKeyActionId !== keyActionIdParam) {
throw 'Invalid ${classname} first byte: ${keyActionId}';
throw `Invalid ${classname} first byte: ${readKeyActionId}`;
}
}
}

View File

@@ -10,7 +10,7 @@ class KeystrokeAction extends KeyAction implements Serializable<KeystrokeAction>
set scancode(value) {
if (!TypeChecker.isScancodeValid(value)) {
throw 'Invalid KeystrokeAction.scancode: ${scancode}';
throw `Invalid KeystrokeAction.scancode: ${value}`;
}
this._scancode = value;
}

View File

@@ -12,7 +12,7 @@ class KeystrokeWithModifiersAction extends KeyAction implements Serializable<Key
set scancode(value) {
if (!TypeChecker.isScancodeValid(value)) {
throw 'Invalid KeystrokeWithModifiersAction.scancode: ${scancode}';
throw `Invalid KeystrokeWithModifiersAction.scancode: ${value}`;
}
this._scancode = value;
}

View File

@@ -25,7 +25,7 @@ class MouseAction extends KeyAction implements Serializable<MouseAction> {
set mouseAction(mouseAction) {
if (!MouseAction.isMouseActionValid(mouseAction)) {
throw 'Invalid MouseAction.mouseAction: ${mouseAction}';
throw `Invalid MouseAction.mouseAction: ${mouseAction}`;
}
this._mouseAction = mouseAction;
}
@@ -45,7 +45,7 @@ class MouseAction extends KeyAction implements Serializable<MouseAction> {
this.mouseAction = buffer.readUInt8();
if (!MouseAction.isMouseActionValid(this.mouseAction)) {
throw 'Invalid MouseAction.param: ${keyActionParam}';
throw `Invalid MouseAction.param: ${this.mouseAction}`;
}
return this;

View File

@@ -13,7 +13,7 @@ class NoneAction extends KeyAction implements Serializable<NoneAction> {
let keyActionParam = buffer.readUInt8();
if (keyActionParam !== NoneAction.noneActionParam) {
throw 'Invalid NoneAction.param: ${keyActionParam}';
throw `Invalid NoneAction.param: ${keyActionParam}`;
}
return this;

View File

@@ -10,7 +10,7 @@ class PlayMacroAction extends KeyAction implements Serializable<PlayMacroAction>
set macroId(value) {
if (!TypeChecker.isUInt8Valid(value)) {
throw 'Invalid PlayMacroAction.macroId: ${value}';
throw `Invalid PlayMacroAction.macroId: ${value}`;
}
this._macroId = value;
}

View File

@@ -10,7 +10,7 @@ class SwitchKeymapAction extends KeyAction implements Serializable<SwitchKeymapA
set keymapId(value) {
if (!TypeChecker.isUInt8Valid(value)) {
throw 'Invalid SwitchKeymapAction.keymapId: ${value}';
throw `Invalid SwitchKeymapAction.keymapId: ${value}`;
}
this._keymapId = value;
}