Skip to content
This repository was archived by the owner on Jan 7, 2022. It is now read-only.

Commit 8c17702

Browse files
juliangruberJoe Hand
authored andcommitted
catch hyperdrive open errors (#185)
1 parent fec93d9 commit 8c17702

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,11 @@ function createDat (dirOrStorage, opts, cb) {
9797

9898
function createArchive () {
9999
archive = hyperdrive(storage, key, opts)
100+
archive.on('error', cb)
100101
archive.ready(function () {
101102
debug('archive ready. version:', archive.version)
102103
if (archive.metadata.has(0) && archive.version) archive.resumed = true
104+
archive.removeListener('error', cb)
103105

104106
cb(null, new Dat(archive, opts))
105107
})

0 commit comments

Comments
 (0)