Skip to content

Commit

Permalink
refactor: complete
Browse files Browse the repository at this point in the history
Signed-off-by: Youngone Lee <youngone.lee@accenture.com>
  • Loading branch information
Leeyoungone committed Dec 30, 2021
1 parent 11a69e6 commit 05b052e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,19 @@ export class PluginObjectStoreIpfs implements IPluginObjectStore {
ex,
);
}
} else if (ex instanceof Error) {
throw new RuntimeError(`unexpected exception`, ex);
} else {
throw new RuntimeError(
"unexpected exception with incorrect type ",
JSON.stringify(ex),
);
if (
(ex as any).stack?.includes(K_IPFS_JS_HTTP_ERROR_FILE_DOES_NOT_EXIST)
) {
const msg = `Stat ${req.key} failed with error message containing phrase "${K_IPFS_JS_HTTP_ERROR_FILE_DOES_NOT_EXIST}" Returning isPresent=false ...`;
this.log.debug(msg);
return { key: req.key, checkedAt, isPresent: false };
} else {
throw new RuntimeError(
`Checking presence of ${req.key} crashed:`,
JSON.stringify(ex),
);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { GetKeychainEntryEndpointV1 } from "./web-services/get-keychain-entry-en
import { SetKeychainEntryEndpointV1 } from "./web-services/set-keychain-entry-endpoint-v1";
import { HasKeychainEntryEndpointV1 } from "./web-services/has-keychain-entry-endpoint-v1";
import { DeleteKeychainEntryEndpointV1 } from "./web-services/delete-keychain-entry-endpoint-v1";
import axios from "axios";

export interface IPluginKeychainVaultOptions extends ICactusPluginOptions {
logLevel?: LogLevelDesc;
keychainId: string;
Expand Down Expand Up @@ -232,12 +232,8 @@ export class PluginKeychainVault implements IPluginWebService, IPluginKeychain {
if ((ex as any).response?.statusCode === HttpStatus.NOT_FOUND) {
return (null as unknown) as string;
} else {
if ((ex as any).response?.status === HttpStatus.NOT_FOUND) {
return (null as unknown) as string;
} else {
this.log.error(`Retrieval of "${key}" crashed:`, ex);
throw ex;
}
this.log.error(`Retrieval of "${key}" crashed:`, ex);
throw ex;
}
}
}
Expand All @@ -263,12 +259,8 @@ export class PluginKeychainVault implements IPluginWebService, IPluginKeychain {
if ((ex as any).response?.statusCode === HttpStatus.NOT_FOUND) {
return false;
} else {
if ((ex as any).response?.status === HttpStatus.NOT_FOUND) {
return false;
} else {
this.log.error(`Presence check of "${key}" crashed:`, ex);
throw ex;
}
this.log.error(`Presence check of "${key}" crashed:`, ex);
throw ex;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory
import { DataTest } from "../data-test";
import DemoHelperJSON from "../../../solidity/contracts/DemoHelpers.json";
import HashTimeLockJSON from "../../../../../../cactus-plugin-htlc-eth-besu/src/main/solidity/contracts/HashTimeLock.json";
import axios from "axios";

const connectorId = uuidv4();
const logLevel: LogLevelDesc = "INFO";
Expand Down

0 comments on commit 05b052e

Please sign in to comment.