-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find a way to catch Error: Another hypercore is stored here error #164
Comments
Just fs.stat the DB folder before attempting to create the new db.
…On Sat, Feb 16, 2019, 10:23 Aral Balkan ***@***.*** wrote:
When creating a new database, if you erroneously try to create a new
database over an existing one, you get the Error: Another hypercore is
stored here. However, I can find no way of catching this error so that I
can handle it gracefully.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#164>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ANY6RmmcFPhd3IL-iA-o3NP67V4dcGBcks5vN9wngaJpZM4a-6hr>
.
|
@m-onz Sorry, I should’ve been more precise: this is with random-access-idb in the browser and, afaics, there doesn’t seem to be a reliable way to see if an IndexDB database exists or not (!!!) |
I've used hyperdb in the browser... Using substacks lib. The DB name
creates a key from your DB name.. Surely you can check that exists. I think
supplying the DB key as the second argument of the constructor each time
might work too.
…On Sat, Feb 16, 2019, 17:01 Aral Balkan ***@***.*** wrote:
@m-onz <https://github.com/m-onz> Sorry, I should’ve been more precise:
this is with random-access-idb in the browser and, afaics, there doesn’t
seem to be a reliable way to see if an IndexDB database exists or not (!!!)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#164 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ANY6Rtr6KH6-dEgWsqpTRC_X4Cr3Jpb7ks5vODlPgaJpZM4a-6hr>
.
|
Regarding my previous point: https://stackoverflow.com/a/23767548 |
I was running into this too and decided to use the discovery key so you can store multiple dats: var crypto = require('hypercore-crypto')
var db = require('random-access-idb')
var key = 'dat://somedatkey'
var discoveryKey = crypto.discoveryKey(key)
var archive = hyperdrive(db(discoveryKey.toString('hex')), key) |
Also, you could store your DB name in local storage or as a cookie. Bit crude but its a work around. |
When creating a new database, if you erroneously try to create a new database over an existing one, you get
Error: Another hypercore is stored here
. However, I can find no way of catching this error so that I can handle it gracefully when using hyperdb.The text was updated successfully, but these errors were encountered: