@ibm-functions/shell-local-plugin
Advanced tools
Comparing version 0.0.11 to 0.0.13
{ | ||
"name": "@ibm-functions/shell-local-plugin", | ||
"version": "0.0.11", | ||
"version": "0.0.13", | ||
"description": "An IBM Cloud Functions Shell plugin that lets users run and debug actions locally in a docker container", | ||
@@ -5,0 +5,0 @@ "main": "plugin.js", |
@@ -44,3 +44,3 @@ /* | ||
htmlIncre = '<div style="-webkit-app-region: no-drag; flex: 1; display: flex"></div>', | ||
spinnerContent ='<div style="display: flex; flex: 1; justify-content: center; align-items: center; font-size: 1.5em"><div class="replay_output" style="order:2;margin-left: 1rem;"></div><div class="replay_spinner" style="animation: spin 2s linear infinite; font-size: 5em; color: var(--color-support-02);"><i class="fas fa-cog"></i></div></div></div>', | ||
spinnerContent ='<div style="display: flex; flex: 1; justify-content: center; align-items: center; font-size: 1.5em"><div class="replay_output" style="min-width:50%;order:2;margin-left: 1.5rem;"></div><div class="replay_spinner" style="animation: spin 2s linear infinite; font-size: 5em; color: var(--color-support-02);"><i class="fas fa-cog"></i></div></div></div>', | ||
debuggerURL = 'chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=0.0.0.0:5858'; | ||
@@ -138,3 +138,3 @@ | ||
.then(res => displayAsActivation('local activation', d, start, wsk, res)) | ||
.catch(e => appendIncreContent(ui.oopsMessage(e), spinnerDiv, 'error')) | ||
.catch(e => appendIncreContent(e, spinnerDiv, 'error')) | ||
} | ||
@@ -171,3 +171,3 @@ else if(argvWithoutOptions[1] === 'debug'){ | ||
.then(() => debug('debug session done', result)) | ||
.catch(e => appendIncreContent(ui.oopsMessage(e), spinnerDiv, 'error')) | ||
.catch(e => appendIncreContent(e, spinnerDiv, 'error')) | ||
} | ||
@@ -181,6 +181,3 @@ else if(argvWithoutOptions[1] === 'init'){ | ||
}) | ||
.catch(e => { | ||
appendIncreContent(e, spinnerDiv, 'error') | ||
removeSpinner(returnDiv) | ||
}); | ||
.catch(e => appendIncreContent(e, spinnerDiv, 'error')) | ||
} | ||
@@ -194,6 +191,3 @@ else if(argvWithoutOptions[1] === 'kill'){ | ||
}) | ||
.catch(e => { | ||
appendIncreContent(e, spinnerDiv, 'error') | ||
removeSpinner(returnDiv) | ||
}); | ||
.catch(e => appendIncreContent(e, spinnerDiv, 'error')) | ||
} | ||
@@ -670,3 +664,4 @@ | ||
}) | ||
.then(() => {resolve(entry)}) | ||
.then(() => {resolve(entry)}) | ||
.catch(reject) | ||
} | ||
@@ -733,2 +728,3 @@ }); | ||
}) | ||
.catch(reject) | ||
}) | ||
@@ -738,2 +734,17 @@ }) | ||
/** | ||
* Determine whether this is user error or internal (our) error | ||
* | ||
*/ | ||
const isUserError = error => { | ||
if (error.statusCode === 404) { | ||
// then this is probably a normal "action not found" error | ||
// from the backend; display the backend's message,to be | ||
// compatible with the REPL's experience | ||
return true | ||
} else { | ||
return false | ||
} | ||
} | ||
/** | ||
* Add a status message | ||
@@ -751,11 +762,6 @@ * | ||
let message = content; | ||
if(content.error){ | ||
if(content.message) | ||
message = content.message; | ||
else | ||
message = JSON.stringify(content, null, 4); | ||
} | ||
const err = content, | ||
message = isUserError(err) ? ui.oopsMessage(err) : 'Internal Error' | ||
$(div).find('.replay_output').append(`<div class='red-text fake-in'>${message}</div>`); | ||
$(div).find('.replay_output').append(`<div style='padding-top:0.25ex' class='red-text fake-in'>${message}</div>`); | ||
} | ||
@@ -762,0 +768,0 @@ else if(typeof content === 'string') { |
67202
900