Merge pull request #425 from Luis-Fernando-Molina/develop

Contribution: Error Handling Improved for command app.update
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-01-20 15:19:48 +01:00
commit 5a511d4d5d
5 files changed
+116 -24

No files matched your search

+40 -6
View File
@@ -666,7 +666,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> err.stack = ' + err.stack)
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> commitMessage = ' + commitMessage)
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> username = ' + username)
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token starts with = ' + token.substring(0, 10) + '...')
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token starts with = ' + token.substring(0, 10) + '...')
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> token ends with = ' + '...' + token.substring(token.length - 10))
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> currentBranch = ' + currentBranch)
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> contributionsBranch = ' + contributionsBranch)
@@ -699,16 +699,49 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
update()
async function update() {
let message = await doGit()
let result = await doGit()
if (message !== undefined) {
if (result.error === undefined) {
let customResponse = {
result: global.CUSTOM_OK_RESPONSE.result,
message: message
message: result.message
}
respondWithContent(JSON.stringify(customResponse), httpResponse)
} else {
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'App Error - Update Failed',
anchor: 'Anchor Update Failed',
placeholder: {}
}
if (result.error.message !== undefined) {
docs.placeholder.errorMessage = {
style: 'Error',
text: result.error.message
}
}
if (result.error.stack !== undefined) {
docs.placeholder.errorStack = {
style: 'Javascript',
text: result.error.stack
}
}
if (result.error.code !== undefined) {
docs.placeholder.errorCode = {
style: 'Json',
text: result.error.code
}
}
let customResponse = {
result: global.CUSTOM_FAIL_RESPONSE.result,
docs: docs
}
respondWithContent(JSON.stringify(customResponse), httpResponse)
}
}
@@ -724,10 +757,11 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
let message
try {
message = await git.pull('https://github.com/Superalgos/Superalgos', currentBranch)
return message
return { message: message }
} catch (err) {
console.log('[ERROR] Error updating ' + currentBranch)
console.log(err.stack)
return { error: err }
}
}
@@ -1,13 +0,0 @@
{
"type": "Backup Entity CONFLICT CREATED",
"definition": {
"text": "Downloads a JSON file with the entity, which may be to whole Workspace or a node, including references concerning the particular node and its offspring. Use this feature to save your entire workspace or any particular structure of nodes within your workspace so that you may later restore the information, including all references, should you need to. For your reference, the file downloaded is named Backup followed by the name of the entity you are backing up.",
"updated": 1610032969934
},
"paragraphs": [
{
"style": "Text",
"text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode."
}
]
}
@@ -11,6 +11,58 @@
"style": "Success",
"text": "Check for the Client's console for details on what may have happened. After you fix the issue, you may try again.",
"updated": 1611129360143
},
{
"style": "Title",
"text": "Error Details"
},
{
"style": "Text",
"text": "In the following section you will find the specific information received when this error occured."
},
{
"style": "Note",
"text": "You will only see it if you opened this page as a result of the error actually happening.",
"updated": 1611151375974
},
{
"style": "Subtitle",
"text": "Error Message"
},
{
"style": "Text",
"text": "The following is the Error Message of the Exception that occured at the Client:",
"updated": 1611151299633
},
{
"style": "Placeholder",
"text": "errorMessage"
},
{
"style": "Subtitle",
"text": "Error Stack"
},
{
"style": "Text",
"text": "The following is the Error Stack of the Exception that occured at the Client:",
"updated": 1611151427220
},
{
"style": "Placeholder",
"text": "errorStack"
},
{
"style": "Subtitle",
"text": "Error Code"
},
{
"style": "Text",
"text": "The follwing is the Error Code of the Exception that occured at the Client:",
"updated": 1611151443562
},
{
"style": "Placeholder",
"text": "errorCode"
}
]
}
@@ -16,8 +16,20 @@
},
{
"style": "Title",
"text": "Error Message",
"updated": 1610971316249
"text": "Error Details",
"updated": 1611151211050
},
{
"style": "Text",
"text": "In the following section you will find the specific information received when this error occured."
},
{
"style": "Note",
"text": "You will only see it if you opened this page as a result of the error actually happening."
},
{
"style": "Subtitle",
"text": "Error Message"
},
{
"style": "Text",
@@ -30,7 +42,7 @@
"updated": 1610971337737
},
{
"style": "Title",
"style": "Subtitle",
"text": "Error Stack",
"updated": 1610968600444
},
@@ -45,7 +57,7 @@
"updated": 1610968640796
},
{
"style": "Title",
"style": "Subtitle",
"text": "Error Code"
},
{
@@ -136,7 +136,14 @@ function newSuperalgosDocsCommmandInterface() {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Message - Update Done - Already Up-To-Date')
}
} else {
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Error - Update Failed', 'Anchor Update Failed')
UI.projects.superalgos.spaces.docsSpace.navigateTo(
data.docs.project,
data.docs.category,
data.docs.type,
data.docs.anchor,
undefined,
data.docs.placeholder
)
}
}
}