From d9ab664a571bcaa769cdfbdec1f6c514c4261983 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 20 Jan 2021 16:01:36 +0100 Subject: [PATCH] This is my contribution to Superalgos --- Client/httpInterface.js | 62 +++++++++---------- ...s-001-app-error-contribution-not-sent.json | 18 +++++- ...ds-errors-003-app-error-update-failed.json | 19 +++++- 3 files changed, 65 insertions(+), 34 deletions(-) diff --git a/Client/httpInterface.js b/Client/httpInterface.js index 460e6f907..5dc84c54e 100644 --- a/Client/httpInterface.js +++ b/Client/httpInterface.js @@ -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) } } diff --git a/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-001-app-error-contribution-not-sent.json b/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-001-app-error-contribution-not-sent.json index c9d083363..8494a6e76 100644 --- a/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-001-app-error-contribution-not-sent.json +++ b/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-001-app-error-contribution-not-sent.json @@ -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": "" diff --git a/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-003-app-error-update-failed.json b/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-003-app-error-update-failed.json index 55523747f..797d43d15 100644 --- a/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-003-app-error-update-failed.json +++ b/Projects/Superalgos/Schemas/Docs-Topics/app-commands-errors-003-app-error-update-failed.json @@ -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": "" } ] } \ No newline at end of file