Skip to content

Commit 23f2b27

Browse files
committed
WIP - #305 fixup
1 parent 1d55287 commit 23f2b27

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

src/vaults/VaultInternal.ts

-11
Original file line numberDiff line numberDiff line change
@@ -316,17 +316,6 @@ class VaultInternal {
316316
);
317317
}
318318

319-
// Is remote?
320-
// well we don't just get remote
321-
// we keep track of it
322-
public async getRemote(): Promise<[NodeId, VaultId]> {
323-
// Get the remote if exists
324-
// if undefined you consider this to be not remote
325-
// and therefore can proceed
326-
// return Promise of [NodeId, VaultId]
327-
throw Error('Not implemented');
328-
}
329-
330319
@ready(new vaultsErrors.ErrorVaultNotRunning())
331320
public async log(
332321
ref: string | VaultRef = 'HEAD',

src/vaults/VaultManager.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,11 @@ class VaultManager {
588588
);
589589
if (existingVaultId == null) break;
590590
newVaultName = `${baseVaultName}-${attempts}`;
591-
if (attempts >= 100) throw Error('MAKE PROPER ERROR');
591+
if (attempts >= 50) {
592+
throw new vaultsErrors.ErrorVaultsNameConflict(
593+
`Too many copies of ${baseVaultName}`,
594+
);
595+
}
592596
attempts++;
593597
}
594598
// Set the vaultName -> vaultId mapping

src/vaults/errors.ts

+6
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ class ErrorVaultsPermissionDenied extends ErrorVaults {
9494
exitCode = sysexits.NOPERM;
9595
}
9696

97+
class ErrorVaultsNameConflict extends ErrorVaults {
98+
description = 'Unique name could not be created';
99+
exitCode = sysexits.UNAVAILABLE;
100+
}
101+
97102
class ErrorSecrets extends ErrorPolykey {}
98103

99104
class ErrorSecretsSecretUndefined extends ErrorSecrets {
@@ -127,6 +132,7 @@ export {
127132
ErrorVaultsCreateVaultId,
128133
ErrorVaultsMergeConflict,
129134
ErrorVaultsPermissionDenied,
135+
ErrorVaultsNameConflict,
130136
ErrorSecrets,
131137
ErrorSecretsSecretUndefined,
132138
ErrorSecretsSecretDefined,

0 commit comments

Comments
 (0)