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

Commit

Permalink
refactor: use assert.fail() instead of throwing for programmer err
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkmc committed Jul 9, 2019
1 parent 02654d3 commit 5a5f324
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/components/pin/gc-lock.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const assert = require('assert')
const mortice = require('mortice')
const pull = require('pull-stream')
const pullThrough = require('pull-stream/throughs/through')
Expand Down Expand Up @@ -32,10 +33,10 @@ class GCLock extends EventEmitter {

lock (type, lockedFn, cb) {
if (typeof lockedFn !== 'function') {
throw new Error(`first argument to ${type} must be a function`)
assert.fail(`first argument to GCLock.${type} must be a function`)
}
if (typeof cb !== 'function') {
throw new Error(`second argument to ${type} must be a callback function`)
assert.fail(`second argument to GCLock.${type} must be a callback function`)
}

const lockId = this.lockId++
Expand Down

0 comments on commit 5a5f324

Please sign in to comment.