This is my contribution to Superalgos
This commit is contained in:
1 parent
5d932ec16d
commit
d9ab664a57
3 files changed
+65
-34
No files matched your search
+30
-32
@@ -627,12 +627,9 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
placeholder: {}
|
||||
}
|
||||
console.log('respond with docs ')
|
||||
try {
|
||||
respondWithDocsObject(docs, error)
|
||||
|
||||
} catch (err) {
|
||||
console.log('new errro ', err)
|
||||
}
|
||||
respondWithDocsObject(docs, error)
|
||||
|
||||
return
|
||||
}
|
||||
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
|
||||
@@ -841,35 +838,36 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
|
||||
function respondWithDocsObject(docs, error) {
|
||||
|
||||
try {
|
||||
if (error.message !== undefined) {
|
||||
docs.placeholder.errorMessage = {
|
||||
style: 'Error',
|
||||
text: error.message
|
||||
}
|
||||
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)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
if (error.stack !== undefined) {
|
||||
docs.placeholder.errorStack = {
|
||||
style: 'Javascript',
|
||||
text: error.stack
|
||||
}
|
||||
}
|
||||
if (error.code !== undefined) {
|
||||
docs.placeholder.errorCode = {
|
||||
style: 'Json',
|
||||
text: error.code
|
||||
}
|
||||
}
|
||||
|
||||
docs.placeholder.errorDetails = {
|
||||
style: 'Json',
|
||||
text: JSON.stringify(error)
|
||||
}
|
||||
|
||||
let customResponse = {
|
||||
result: global.CUSTOM_FAIL_RESPONSE.result,
|
||||
docs: docs
|
||||
}
|
||||
|
||||
respondWithContent(JSON.stringify(customResponse), httpResponse)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+17
-1
@@ -14,7 +14,8 @@
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
"text": "Error Details"
|
||||
"text": "Error Info",
|
||||
"updated": 1611154606702
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
@@ -61,6 +62,21 @@
|
||||
"style": "Placeholder",
|
||||
"text": "errorCode"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Details",
|
||||
"updated": 1611154543778
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The follwing are all the Error details of the Exception that occured at the Client:",
|
||||
"updated": 1611154675224
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorDetails",
|
||||
"updated": 1611154555419
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": ""
|
||||
|
||||
+18
-1
@@ -14,7 +14,8 @@
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
"text": "Error Details"
|
||||
"text": "Error Info",
|
||||
"updated": 1611154641024
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
@@ -63,6 +64,22 @@
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorCode"
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Error Details"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "The follwing are all the Error details of the Exception that occured at the Client:"
|
||||
},
|
||||
{
|
||||
"style": "Placeholder",
|
||||
"text": "errorDetails"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user