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

Contribution: Improvements in Error Handlng / Error UX
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-01-21 20:58:37 +01:00
commit 9e30cb8fcc
8 files changed
+122 -9

No files matched your search

+1 -1
View File
@@ -155,7 +155,7 @@
</div>
<div class="menu-row">
<div class="menu-item" onClick="window.contextMenu.toPlaceholder()">
<img src="Icons/Superalgos/bitcoin.png" class="menu-img" title="Placeholder">
<img src="Icons/Superalgos/docs-placeholder-style.png" class="menu-img" title="Placeholder">
</div>
<div class="menu-item" onClick="window.contextMenu.toSummary()">
<img src="Icons/Superalgos/docs-summary-style.png" class="menu-img" title="Summary">
+3 -2
View File
@@ -599,7 +599,8 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
/* Unsavping # */
for (let i = 0; i < 10; i++) {
commitMessage = commitMessage.replace('HASHTAG', '#')
commitMessage = commitMessage.replace('_SLASH_', '/')
commitMessage = commitMessage.replace('_HASHTAG_', '#')
}
contribute()
@@ -1352,7 +1353,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
let pathToFile = httpRequest.url.substring(9)
/* Unsavping # */
for (let i = 0; i < 10; i++) {
pathToFile = pathToFile.replace('HASHTAG', '#')
pathToFile = pathToFile.replace('_HASHTAG_', '#')
}
respondWithFile(global.env.PATH_TO_DATA_STORAGE + '/' + pathToFile, httpResponse)
}
@@ -13,6 +13,72 @@
{
"style": "Error",
"text": "Unexpected Error"
},
{
"style": "Title",
"text": "Error Details",
"updated": 1611258020914
},
{
"style": "Text",
"text": "In the following section you will find the specific information received when this error occured."
},
{
"style": "Success",
"text": "You will only see it if you opened this page as a result of the error actually happening.",
"updated": 1611258030660
},
{
"style": "Subtitle",
"text": "Error Message"
},
{
"style": "Text",
"text": "The following is the Error Message of the Exception that occured at the TS:"
},
{
"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 TS:"
},
{
"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 TS:"
},
{
"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 TS:"
},
{
"style": "Placeholder",
"text": "errorDetails"
},
{
"style": "Text",
"text": ""
}
]
}
@@ -68,6 +68,23 @@
"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 TS:",
"updated": 1611257840235
},
{
"style": "Placeholder",
"text": "errorDetails"
},
{
"style": "Text",
"text": ""
},
{
"style": "Text",
"text": ""
@@ -43,6 +43,10 @@ exports.newSuperalgosFunctionLibrariesNodeJSFunctions = function () {
text: TS.projects.superalgos.globals.taskVariables.UNEXPECTED_ERROR.code
}
}
docs.placeholder.errorDetails = {
style: 'Json',
text: JSON.stringify(TS.projects.superalgos.globals.taskVariables.UNEXPECTED_ERROR, undefined, 4)
}
}
if (TS.projects.superalgos.globals.taskVariables.FATAL_ERROR_MESSAGE || TS.projects.superalgos.globals.taskVariables.UNEXPECTED_ERROR) {
@@ -62,10 +62,13 @@ function newSuperalgosDocsCommmandInterface() {
return
}
message = message.replaceAll('#', '_HASHTAG_')
message = message.replaceAll('/', '_SLASH_')
httpRequest(
undefined,
'App/Contribute/' +
message.replaceAll('#', 'HASHTAG') + '/' +
message + '/' +
config.username + '/' +
config.token + '/' +
UI.projects.superalgos.spaces.docsSpace.currentBranch + '/' +
@@ -25,6 +25,7 @@ function newUiObjectMessage() {
thisObject.container.frame.radius = 0
let selfMouseClickEventSubscriptionId
let hoverAnimationCounter = 0
return thisObject
@@ -50,6 +51,7 @@ function newUiObjectMessage() {
function getContainer(point) {
if (thisObject.text === undefined) { return }
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
hoverAnimationCounter = 30
return thisObject.container
} else {
return undefined
@@ -68,6 +70,11 @@ function newUiObjectMessage() {
thisObject.container.frame.width = FRAME_WIDTH
thisObject.container.frame.height = FRAME_HEIGHT
hoverAnimationCounter--
if (hoverAnimationCounter < 0) {
hoverAnimationCounter = 0
}
}
function onMouseClick(event) {
@@ -120,15 +127,29 @@ function newUiObjectMessage() {
}
}
function drawMessageBackground(borderColor) {
function drawMessageBackground(color) {
if (thisObject.text === undefined) { return }
let backgroundColor
let borderColor
let lineWidth
if (hoverAnimationCounter > 0 && thisObject.docs !== undefined) {
backgroundColor = UI_COLOR.LIGHT_GREY
borderColor = color
lineWidth = 2
} else {
backgroundColor = UI.projects.superalgos.spaces.floatingSpace.style.backgroundColor
borderColor = color
lineWidth = 0.5
}
let params = {
cornerRadius: 5,
lineWidth: 0.5,
cornerRadius: 10,
lineWidth: lineWidth,
container: thisObject.container,
borderColor: borderColor,
backgroundColor: UI.projects.superalgos.spaces.floatingSpace.style.backgroundColor,
backgroundColor: backgroundColor,
castShadow: false,
opacity: 0.75
}
+2 -1
View File
@@ -46,7 +46,8 @@ function newFileStorage(host, port) {
}
/* Scaping # since it breaks the URL */
url = url.replaceAll('#', 'HASHTAG')
url = url.replaceAll('#', '_HASHTAG_')
httpRequest(undefined, url, (response, fileContent) => {
if (response.result === GLOBAL.DEFAULT_OK_RESPONSE.result) {
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE, fileContent)