Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 7b2fd2e

Browse files
authored
Adding try/catch to prevent endpointkey to stop the update. (#1253)
* Adding try/catch to prevent endpointkey to stop the update. * Using string formatting
1 parent 591a4b6 commit 7b2fd2e

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

packages/qnamaker/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"camelcase": "^4.1.0",
5050
"chalk": "2.4.1",
5151
"cli-table3": "^0.5.1",
52-
"cli-ux": "^5.3.0",
52+
"cli-ux": "^5.6.2",
5353
"fs-extra": "^5.0.0",
5454
"get-stdin": "^6.0.0",
5555
"https-proxy-agent": "^2.2.1",

packages/qnamaker/src/commands/qnamaker/init.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,15 @@ export default class QnamakerInit extends Command {
6868
}
6969

7070
async updateKbId(config: any) {
71-
let response = await new Endpointkeys().getEndpointKeys(config)
72-
config.endpointKey = response.data.primaryEndpointKey
73-
74-
response = await new Knowledgebase().getKnowledgebaseDetails(config)
75-
let kb = await response.data
76-
config.hostname = kb.hostName
71+
try {
72+
let response = await new Endpointkeys().getEndpointKeys(config)
73+
config.endpointKey = response.data.primaryEndpointKey
74+
75+
response = await new Knowledgebase().getKnowledgebaseDetails(config)
76+
let kb = response.data
77+
config.hostname = kb.hostName
78+
} catch (error) {
79+
this.error(`Update of KB endpoint key and hostname failed: ${error}`)
80+
}
7781
}
7882
}

0 commit comments

Comments
 (0)