Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 5a5f324

Browse files
committed
refactor: use assert.fail() instead of throwing for programmer err
1 parent 02654d3 commit 5a5f324

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/core/components/pin/gc-lock.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict'
22

3+
const assert = require('assert')
34
const mortice = require('mortice')
45
const pull = require('pull-stream')
56
const pullThrough = require('pull-stream/throughs/through')
@@ -32,10 +33,10 @@ class GCLock extends EventEmitter {
3233

3334
lock (type, lockedFn, cb) {
3435
if (typeof lockedFn !== 'function') {
35-
throw new Error(`first argument to ${type} must be a function`)
36+
assert.fail(`first argument to GCLock.${type} must be a function`)
3637
}
3738
if (typeof cb !== 'function') {
38-
throw new Error(`second argument to ${type} must be a callback function`)
39+
assert.fail(`second argument to GCLock.${type} must be a callback function`)
3940
}
4041

4142
const lockId = this.lockId++

0 commit comments

Comments
 (0)