Skip to content

Commit

Permalink
WIP - #305 fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
tegefaulkes committed Mar 9, 2022
1 parent 1d55287 commit 23f2b27
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
11 changes: 0 additions & 11 deletions src/vaults/VaultInternal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,17 +316,6 @@ class VaultInternal {
);
}

// Is remote?
// well we don't just get remote
// we keep track of it
public async getRemote(): Promise<[NodeId, VaultId]> {
// Get the remote if exists
// if undefined you consider this to be not remote
// and therefore can proceed
// return Promise of [NodeId, VaultId]
throw Error('Not implemented');
}

@ready(new vaultsErrors.ErrorVaultNotRunning())
public async log(
ref: string | VaultRef = 'HEAD',
Expand Down
6 changes: 5 additions & 1 deletion src/vaults/VaultManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,11 @@ class VaultManager {
);
if (existingVaultId == null) break;
newVaultName = `${baseVaultName}-${attempts}`;
if (attempts >= 100) throw Error('MAKE PROPER ERROR');
if (attempts >= 50) {
throw new vaultsErrors.ErrorVaultsNameConflict(
`Too many copies of ${baseVaultName}`,
);
}
attempts++;
}
// Set the vaultName -> vaultId mapping
Expand Down
6 changes: 6 additions & 0 deletions src/vaults/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ class ErrorVaultsPermissionDenied extends ErrorVaults {
exitCode = sysexits.NOPERM;
}

class ErrorVaultsNameConflict extends ErrorVaults {
description = 'Unique name could not be created';
exitCode = sysexits.UNAVAILABLE;
}

class ErrorSecrets extends ErrorPolykey {}

class ErrorSecretsSecretUndefined extends ErrorSecrets {
Expand Down Expand Up @@ -127,6 +132,7 @@ export {
ErrorVaultsCreateVaultId,
ErrorVaultsMergeConflict,
ErrorVaultsPermissionDenied,
ErrorVaultsNameConflict,
ErrorSecrets,
ErrorSecretsSecretUndefined,
ErrorSecretsSecretDefined,
Expand Down

0 comments on commit 23f2b27

Please sign in to comment.