This is my contribution to Superalgos
This commit is contained in:
1 parent
ac891d603d
commit
eb1ad95d66
4 files changed
+125
-39
No files matched your search
+60
-34
@@ -599,12 +599,34 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
contribute()
|
||||
|
||||
async function contribute() {
|
||||
if (await doGit() === false) {
|
||||
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
|
||||
let error
|
||||
error = await doGit()
|
||||
if (error !== undefined) {
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'App Error - Contribution Not Sent',
|
||||
anchor: undefined,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
respondWithDocsObject(docs, result.error)
|
||||
return
|
||||
}
|
||||
if (await doGithub() === false) {
|
||||
respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
|
||||
|
||||
error = await doGithub()
|
||||
if (error !== undefined) {
|
||||
|
||||
let docs = {
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'App Error - Contribution Not Sent',
|
||||
anchor: undefined,
|
||||
placeholder: {}
|
||||
}
|
||||
|
||||
respondWithDocsObject(docs, result.error)
|
||||
return
|
||||
}
|
||||
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
|
||||
@@ -623,14 +645,13 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
await git.add('./*')
|
||||
await git.commit(commitMessage)
|
||||
await git.push('origin', currentBranch)
|
||||
return true
|
||||
} catch (err) {
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGit -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGit -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGit -> commitMessage = ' + commitMessage)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGit -> currentBranch = ' + currentBranch)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGit -> contributionsBranch = ' + contributionsBranch)
|
||||
return false
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -657,10 +678,9 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
head,
|
||||
base,
|
||||
});
|
||||
return true
|
||||
} catch (err) {
|
||||
if (err.stack.indexOf('A pull request already exists') >= 0) {
|
||||
return true
|
||||
return
|
||||
} else {
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> doGithub -> err.stack = ' + err.stack)
|
||||
@@ -670,7 +690,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
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)
|
||||
return false
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -713,35 +733,12 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
project: 'Superalgos',
|
||||
category: 'Topic',
|
||||
type: 'App Error - Update Failed',
|
||||
anchor: 'Anchor Update Failed',
|
||||
anchor: undefined,
|
||||
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
|
||||
}
|
||||
}
|
||||
respondWithDocsObject(docs, result.error)
|
||||
|
||||
let customResponse = {
|
||||
result: global.CUSTOM_FAIL_RESPONSE.result,
|
||||
docs: docs
|
||||
}
|
||||
|
||||
respondWithContent(JSON.stringify(customResponse), httpResponse)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -831,6 +828,35 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
function respondWithDocsObject(docs, error) {
|
||||
|
||||
if (error.message !== undefined) {
|
||||
docs.placeholder.errorMessage = {
|
||||
style: 'Error',
|
||||
text: error.message
|
||||
}
|
||||
}
|
||||
if (error.stack !== undefined) {
|
||||
docs.placeholder.errorStack = {
|
||||
style: 'Javascript',
|
||||
text: error.stack
|
||||
}
|
||||
}
|
||||
if (error.code !== undefined) {
|
||||
docs.placeholder.errorCode = {
|
||||
style: 'Json',
|
||||
text: error.code
|
||||
}
|
||||
}
|
||||
|
||||
let customResponse = {
|
||||
result: global.CUSTOM_FAIL_RESPONSE.result,
|
||||
docs: docs
|
||||
}
|
||||
|
||||
respondWithContent(JSON.stringify(customResponse), httpResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
|
||||
+55
-2
@@ -9,8 +9,61 @@
|
||||
"paragraphs": [
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "Check for the Client's console for details on what may have happened. After you fix the issue that prevented the App Contribute Command to run, you may try again.",
|
||||
"updated": 1611129009743
|
||||
"text": "Check the following section for details on what may have happened. After you fix the issue that prevented the App Contribute Command to run, you may try again.",
|
||||
"updated": 1611152997869
|
||||
},
|
||||
{
|
||||
"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": 1611153032408
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Message"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The following is the Error Message of the Exception that occured at the Client:"
|
||||
},
|
||||
{
|
||||
"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:"
|
||||
},
|
||||
{
|
||||
"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:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorCode"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
+2
-2
@@ -9,8 +9,8 @@
|
||||
"paragraphs": [
|
||||
{
|
||||
"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
|
||||
"text": "Check for the following section for details on what may have happened. After you fix the issue, you may try again.",
|
||||
"updated": 1611152967185
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
|
||||
@@ -82,7 +82,14 @@ function newSuperalgosDocsCommmandInterface() {
|
||||
if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result && data.result === GLOBAL.DEFAULT_OK_RESPONSE.result) {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Message - Contribution Done')
|
||||
} else {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Error - Contribution Not Sent', 'Anchor Contribution Not Sent')
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo(
|
||||
data.docs.project,
|
||||
data.docs.category,
|
||||
data.docs.type,
|
||||
data.docs.anchor,
|
||||
undefined,
|
||||
data.docs.placeholder
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user