This is an automated email from the ASF dual-hosted git repository. alexkli pushed a commit to branch optional-ngrok in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git
commit d09ee7289414ae282d1cd9f0fa069a09331c08ab Author: Alexander Klimetschek <[email protected]> AuthorDate: Thu Apr 9 22:44:54 2020 -0700 better error message if no openwhisk credentials are found --- src/debugger.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/debugger.js b/src/debugger.js index 8cf08fb..b58cd0b 100644 --- a/src/debugger.js +++ b/src/debugger.js @@ -34,6 +34,11 @@ class Debugger { this.actionName = argv.action; this.wskProps = wskprops.get(); + console.log(this.wskProps); + if (Object.keys(this.wskProps).length === 0) { + console.error(`Error: Missing openwhisk credentials. Found no ~/.wskprops file or WSK_* environment variable.`); + process.exit(1); + } if (argv.ignoreCerts) { this.wskProps.ignore_certs = true; } @@ -221,7 +226,12 @@ class Debugger { async setupWsk() { if (!this.wsk) { - this.wsk = openwhisk(this.wskProps); + try { + this.wsk = openwhisk(this.wskProps); + } catch (err) { + console.error(`Error: Could not setup openwhisk client: ${err.message}`); + process.exit(1); + } if (this.wskProps.namespace === undefined) { // there is a strict 1-1 bijection between auth and namespace, hence auth is enough. // while the openwhisk() client does not care about the namespace being set,
