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

Commit

Permalink
chore: address review
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed May 28, 2020
1 parent 3ac8b48 commit 0a92322
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 3 additions & 1 deletion packages/ipfs/src/core/components/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const Bitswap = require('ipfs-bitswap')
const multiaddr = require('multiaddr')
const get = require('dlv')
const defer = require('p-defer')
const errCode = require('err-code')
const IPNS = require('../ipns')
const routingConfig = require('../ipns/routing/config')
const { AlreadyInitializedError, NotEnabledError } = require('../errors')
Expand Down Expand Up @@ -45,7 +46,7 @@ module.exports = ({
// Temporary error for users migrating using websocket-star multiaddrs for listenning on libp2p
// websocket-star support was removed from ipfs and libp2p
if (ma.protoCodes().includes(WEBSOCKET_STAR_PROTO_CODE)) {
throw new Error('websocket-star swarm addresses are not supported. See https://github.com/ipfs/js-ipfs/issues/2779')
throw errCode(new Error('websocket-star swarm addresses are not supported. See https://github.com/ipfs/js-ipfs/issues/2779'), 'ERR_WEBSOCKET_STAR_SWARM_ADDR_NOT_SUPPORTED')
}

// multiaddrs that go via a signalling server or other intermediary (e.g. stardust,
Expand Down Expand Up @@ -138,6 +139,7 @@ module.exports = ({
apiManager.update(api, () => undefined)
} catch (err) {
cancel()
startPromise.reject(err)
throw err
}

Expand Down
9 changes: 1 addition & 8 deletions packages/ipfs/test/core/create-node.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,6 @@ describe('create node', function () {
preload: { enabled: false }
})

try {
await node.start()
} catch (err) {
expect(err).to.exist()
return
}

throw new Error('should error when receiving websocket-star swarm addresses')
await expect(node.start()).to.eventually.be.rejected().with.property('code', 'ERR_WEBSOCKET_STAR_SWARM_ADDR_NOT_SUPPORTED')
})
})

0 comments on commit 0a92322

Please sign in to comment.