Skip to content

Commit 68aa8c4

Browse files
committed
Remove unused catch variables
1 parent 70476ac commit 68aa8c4

File tree

10 files changed

+20
-20
lines changed

10 files changed

+20
-20
lines changed

dist/lib/growable-buffer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class GrowableBuffer extends appendable_1.default {
2222
assert_1.default.integer(initialLength);
2323
assert_1.default(initialLength >= 0);
2424
}
25-
catch (e) {
25+
catch (_a) {
2626
throw new RangeError(`${initialLength} is not a valid buffer length`);
2727
}
2828
this.buffer = new ArrayBuffer(initialLength);

dist/types/choice.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class ChoiceType extends absolute_1.default {
4848
try {
4949
assert_1.default.byteUnsignedInteger(types.length);
5050
}
51-
catch (e) {
51+
catch (_a) {
5252
assert_1.default.fail(`${types.length} types is too many`);
5353
}
5454
for (const type of types)
@@ -101,7 +101,7 @@ class ChoiceType extends absolute_1.default {
101101
success = true;
102102
break;
103103
}
104-
catch (e) {
104+
catch (_a) {
105105
buffer.reset();
106106
}
107107
}

dist/types/enum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class EnumType extends abstract_1.default {
4141
try {
4242
assert_1.default.byteUnsignedInteger(values.length);
4343
}
44-
catch (e) {
44+
catch (_a) {
4545
assert_1.default.fail(`${values.length} values is too many`);
4646
}
4747
this.type = type;

dist/types/named-choice.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class NamedChoiceType extends absolute_1.default {
6969
try {
7070
assert_1.default.byteUnsignedInteger(constructorTypes.size);
7171
}
72-
catch (e) {
72+
catch (_a) {
7373
assert_1.default.fail(`${constructorTypes.size} types is too many`);
7474
}
7575
this.indexConstructors = new Map;
@@ -86,7 +86,7 @@ class NamedChoiceType extends absolute_1.default {
8686
try {
8787
assert_1.default.byteUnsignedInteger(typeNameBuffer.byteLength);
8888
}
89-
catch (e) {
89+
catch (_b) {
9090
assert_1.default.fail(`Function name "${name}" is too long`);
9191
}
9292
assert_1.default.instanceOf(type, struct_1.default);
@@ -182,7 +182,7 @@ class NamedChoiceType extends absolute_1.default {
182182
try {
183183
assert_1.default.equal(otherConstructor.nameBuffer, thisConstructor.nameBuffer);
184184
}
185-
catch (e) {
185+
catch (_a) {
186186
return false;
187187
}
188188
}

dist/types/struct.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class StructType extends absolute_1.default {
5252
try {
5353
assert_1.default.byteUnsignedInteger(fieldCount);
5454
}
55-
catch (e) {
55+
catch (_a) {
5656
assert_1.default.fail(`${fieldCount} fields is too many`);
5757
}
5858
this.fields = new Array(fieldCount); //really a set, but we want ordering to be fixed so that type bytes are consistent
@@ -65,15 +65,15 @@ class StructType extends absolute_1.default {
6565
try {
6666
assert_1.default.byteUnsignedInteger(fieldNameBuffer.byteLength);
6767
}
68-
catch (e) {
68+
catch (_b) {
6969
assert_1.default.fail(`Field name ${fieldName} is too long`);
7070
}
7171
//Type must be a Type
7272
const fieldType = fields[fieldName];
7373
try {
7474
assert_1.default.instanceOf(fieldType, abstract_1.default);
7575
}
76-
catch (e) {
76+
catch (_c) {
7777
assert_1.default.fail(util_inspect_1.inspect(fieldType) + ' is not a valid field type');
7878
}
7979
this.fields[fieldIndex] = {

lib/growable-buffer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default class GrowableBuffer extends AppendableBuffer {
2727
assert.integer(initialLength)
2828
assert(initialLength >= 0)
2929
}
30-
catch (e) { throw new RangeError(`${initialLength} is not a valid buffer length`) }
30+
catch { throw new RangeError(`${initialLength} is not a valid buffer length`) }
3131
this.buffer = new ArrayBuffer(initialLength)
3232
this.size = 0
3333
this.pausePoints = []

types/choice.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default class ChoiceType<E, READ_E extends E = E> extends AbsoluteType<E,
5454
super()
5555
assert.instanceOf(types, Array)
5656
try { assert.byteUnsignedInteger(types.length) }
57-
catch (e) { assert.fail(`${types.length} types is too many`) }
57+
catch { assert.fail(`${types.length} types is too many`) }
5858
for (const type of types) assert.instanceOf(type, AbstractType)
5959
this.types = types
6060
}
@@ -100,7 +100,7 @@ export default class ChoiceType<E, READ_E extends E = E> extends AbsoluteType<E,
100100
success = true
101101
break
102102
}
103-
catch (e) { buffer.reset() }
103+
catch { buffer.reset() }
104104
}
105105
buffer.resume()
106106
if (!success) assert.fail('No types matched: ' + inspect(value))

types/enum.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default class EnumType<E> extends AbstractType<E> {
5151
assert.instanceOf(values, Array)
5252
//At most 255 values allowed
5353
try { assert.byteUnsignedInteger(values.length) }
54-
catch (e) { assert.fail(`${values.length} values is too many`) }
54+
catch { assert.fail(`${values.length} values is too many`) }
5555

5656
this.type = type
5757
this.values = values //used when reading to get constant-time lookup of value index into value

types/named-choice.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export default class NamedChoiceType<E extends object, READ_E extends E = E> ext
8383
super()
8484
assert.instanceOf(constructorTypes, Map)
8585
try { assert.byteUnsignedInteger(constructorTypes.size) }
86-
catch (e) { assert.fail(`${constructorTypes.size} types is too many`) }
86+
catch { assert.fail(`${constructorTypes.size} types is too many`) }
8787
this.indexConstructors = new Map
8888
this.constructorTypes = new Array(constructorTypes.size)
8989
const usedNames = new Set<string>()
@@ -96,7 +96,7 @@ export default class NamedChoiceType<E extends object, READ_E extends E = E> ext
9696
//Name must fit in 255 UTF-8 bytes
9797
const typeNameBuffer = bufferString.fromString(name)
9898
try { assert.byteUnsignedInteger(typeNameBuffer.byteLength) }
99-
catch (e) { assert.fail(`Function name "${name}" is too long`) }
99+
catch { assert.fail(`Function name "${name}" is too long`) }
100100
assert.instanceOf(type, StructType)
101101
const constructorIndex = this.indexConstructors.size
102102
this.indexConstructors.set(constructorIndex, constructor)
@@ -184,7 +184,7 @@ export default class NamedChoiceType<E extends object, READ_E extends E = E> ext
184184
const otherConstructor = otherChoiceType.constructorTypes[i]
185185
if (!thisConstructor.type.equals(otherConstructor.type)) return false
186186
try { assert.equal(otherConstructor.nameBuffer, thisConstructor.nameBuffer) }
187-
catch (e) { return false }
187+
catch { return false }
188188
}
189189
return true
190190
}

types/struct.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default class StructType<E extends StringIndexable, READ_E extends E = E>
8181
//Allow only 255 fields
8282
const fieldCount = Object.keys(fields).length
8383
try { assert.byteUnsignedInteger(fieldCount) }
84-
catch (e) { assert.fail(`${fieldCount} fields is too many`) }
84+
catch { assert.fail(`${fieldCount} fields is too many`) }
8585

8686
this.fields = new Array(fieldCount) //really a set, but we want ordering to be fixed so that type bytes are consistent
8787
let fieldIndex = 0
@@ -90,11 +90,11 @@ export default class StructType<E extends StringIndexable, READ_E extends E = E>
9090
//Name must fit in 255 UTF-8 bytes
9191
const fieldNameBuffer = bufferString.fromString(fieldName)
9292
try { assert.byteUnsignedInteger(fieldNameBuffer.byteLength) }
93-
catch (e) { assert.fail(`Field name ${fieldName} is too long`) }
93+
catch { assert.fail(`Field name ${fieldName} is too long`) }
9494
//Type must be a Type
9595
const fieldType = fields[fieldName]
9696
try { assert.instanceOf(fieldType, AbstractType) }
97-
catch (e) { assert.fail(inspect(fieldType) + ' is not a valid field type') }
97+
catch { assert.fail(inspect(fieldType) + ' is not a valid field type') }
9898
this.fields[fieldIndex] = {
9999
name: fieldName,
100100
type: fieldType,

0 commit comments

Comments
 (0)