Skip to content

Commit 1e1e00e

Browse files
committed
wrap create CachJson to try catch
1 parent c6c73e4 commit 1e1e00e

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

lib/pkistore/pkistore.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,13 @@ namespace trusted.pkistore {
180180
super();
181181
if (typeof (param) === "string") {
182182
this.handle = new native.PKISTORE.PkiStore(param);
183-
this.cashJson = new CashJson(param);
183+
184+
try {
185+
this.cashJson = new CashJson(param);
186+
} catch (e) {
187+
//
188+
}
189+
184190
} else if (param instanceof native.PKISTORE.PkiStore) {
185191
this.handle = param;
186192
} else {

test/store.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,12 @@ describe("Store", function() {
131131
var exportPKI;
132132

133133
items = store.find();
134-
store.cash.import(items);
135-
exportPKI = store.cash.export();
134+
135+
if (store.cash) {
136+
store.cash.import(items);
137+
exportPKI = store.cash.export();
138+
}
139+
136140
assert.equal(exportPKI.length > 0, true);
137141
});
138142

0 commit comments

Comments
 (0)