API Data Fetcher Bot Error Handling

This commit is contained in:
Luis Fernando Molina committed 2021-05-24 17:43:51 +02:00
1 parent 15e2e1ac67
commit 9b1714b2e7
11 files changed
+871 -26

No files matched your search

@@ -1,10 +1,10 @@
{
"topic": "TS API Data Fetcher Bot Error",
"pageNumber": "1",
"pageNumber": "2",
"type": "TS API Data Fetcher Bot Error - Reference Parent Missing",
"definition": {
"text": "The node where this error occured needs to have a child of type API Map Reference referencing the API Map. This API Map will tell the bot how to locate the API Server and how to extract data from it.",
"updated": 1621859784437
"text": "The node where this error occured needs to have a Reference Parent. Establish a reference from this node and this error will not happen again.",
"updated": 1621860822884
},
"paragraphs": [
{
@@ -0,0 +1,101 @@
{
"topic": "TS API Data Fetcher Bot Error",
"pageNumber": "3",
"type": "TS API Data Fetcher Bot Error - Config Property Missing",
"definition": {
"text": "There is a required property at the config of this no that is missing. Add this property in order for the API Data Fetcher Bot to be able to run properly. Check the details below to learn specifically which one is the missing property.",
"updated": 1621860822884
},
"paragraphs": [
{
"style": "Error",
"text": "Config Property Missing",
"updated": 1621860374194
},
{
"style": "Title",
"text": "Error Info"
},
{
"style": "Text",
"text": "In the following section, you will find the information recorded when the error occurred."
},
{
"style": "Text",
"text": "You will only see the information if you opened this page as a result of the error actually occurring.",
"updated": 1611680880668
},
{
"style": "Subtitle",
"text": "Error Message"
},
{
"style": "Text",
"text": "The following is the Error Message of the Exception that occured at the API Data Fetcher Bot:"
},
{
"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 API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorStack"
},
{
"style": "Subtitle",
"text": "Error Code"
},
{
"style": "Text",
"text": "The following is the Error Code of the Exception that occured at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorCode"
},
{
"style": "Subtitle",
"text": "Error Details"
},
{
"style": "Text",
"text": "The following are all the Error details of the Exception that occured at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorDetails"
},
{
"style": "Subtitle",
"text": "Node Name"
},
{
"style": "Text",
"text": "The following is the node's name of the Node most related to this error:"
},
{
"style": "Placeholder",
"text": "nodeName"
},
{
"style": "Subtitle",
"text": "Node Code"
},
{
"style": "Text",
"text": "The following is the code stored at the node that produced the error at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "nodeCode"
}
]
}
@@ -1,15 +1,15 @@
{
"topic": "TS API Data Fetcher Bot Error",
"pageNumber": "1",
"type": "TS API Data Fetcher Bot Error - Reference Parent Missing",
"pageNumber": "4",
"type": "TS API Data Fetcher Bot Error - API Version Node Missing",
"definition": {
"text": "The node where this error occured needs to have a Reference Parent. Establish a reference from this node and this error will not happen again.",
"text": "There is a child node of type API Version of the current node that is missing. Add this child node in order for the API Data Fetcher Bot to be able to run properly.",
"updated": 1621860822884
},
"paragraphs": [
{
"style": "Error",
"text": "Reference Parent Missing",
"text": "API Version Node Missing",
"updated": 1621860374194
},
{
@@ -0,0 +1,101 @@
{
"topic": "TS API Data Fetcher Bot Error",
"pageNumber": "5",
"type": "TS API Data Fetcher Bot Error - Process Output Node Missing",
"definition": {
"text": "There is a child node of type Process Output of the current node that is missing. Add this child node in order for the API Data Fetcher Bot to be able to run properly.",
"updated": 1621860822884
},
"paragraphs": [
{
"style": "Error",
"text": "API Version Node Missing",
"updated": 1621860374194
},
{
"style": "Title",
"text": "Error Info"
},
{
"style": "Text",
"text": "In the following section, you will find the information recorded when the error occurred."
},
{
"style": "Text",
"text": "You will only see the information if you opened this page as a result of the error actually occurring.",
"updated": 1611680880668
},
{
"style": "Subtitle",
"text": "Error Message"
},
{
"style": "Text",
"text": "The following is the Error Message of the Exception that occured at the API Data Fetcher Bot:"
},
{
"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 API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorStack"
},
{
"style": "Subtitle",
"text": "Error Code"
},
{
"style": "Text",
"text": "The following is the Error Code of the Exception that occured at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorCode"
},
{
"style": "Subtitle",
"text": "Error Details"
},
{
"style": "Text",
"text": "The following are all the Error details of the Exception that occured at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorDetails"
},
{
"style": "Subtitle",
"text": "Node Name"
},
{
"style": "Text",
"text": "The following is the node's name of the Node most related to this error:"
},
{
"style": "Placeholder",
"text": "nodeName"
},
{
"style": "Subtitle",
"text": "Node Code"
},
{
"style": "Text",
"text": "The following is the code stored at the node that produced the error at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "nodeCode"
}
]
}
@@ -0,0 +1,101 @@
{
"topic": "TS API Data Fetcher Bot Error",
"pageNumber": "6",
"type": "TS API Data Fetcher Bot Error - API Response Field Not Descendant From Endpoint",
"definition": {
"text": "Every API Response Field Node needs to descend from an API Endpoint node. Check this node's parent node, and it's parent, and continue until you find the API Endpoint. Find the place where the chain is broken and fix it in order for the API Data Fetcher Bot to be able to preccedd.",
"updated": 1621860822884
},
"paragraphs": [
{
"style": "Error",
"text": "API Response Field Not Descendant From Endpoint",
"updated": 1621860374194
},
{
"style": "Title",
"text": "Error Info"
},
{
"style": "Text",
"text": "In the following section, you will find the information recorded when the error occurred."
},
{
"style": "Text",
"text": "You will only see the information if you opened this page as a result of the error actually occurring.",
"updated": 1611680880668
},
{
"style": "Subtitle",
"text": "Error Message"
},
{
"style": "Text",
"text": "The following is the Error Message of the Exception that occured at the API Data Fetcher Bot:"
},
{
"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 API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorStack"
},
{
"style": "Subtitle",
"text": "Error Code"
},
{
"style": "Text",
"text": "The following is the Error Code of the Exception that occured at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorCode"
},
{
"style": "Subtitle",
"text": "Error Details"
},
{
"style": "Text",
"text": "The following are all the Error details of the Exception that occured at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorDetails"
},
{
"style": "Subtitle",
"text": "Node Name"
},
{
"style": "Text",
"text": "The following is the node's name of the Node most related to this error:"
},
{
"style": "Placeholder",
"text": "nodeName"
},
{
"style": "Subtitle",
"text": "Node Code"
},
{
"style": "Text",
"text": "The following is the code stored at the node that produced the error at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "nodeCode"
}
]
}
@@ -0,0 +1,101 @@
{
"topic": "TS API Data Fetcher Bot Error",
"pageNumber": "7",
"type": "TS API Data Fetcher Bot Error - More Than Two Endpoints Detected",
"definition": {
"text": "Each process of the API Data Fetcher Bot is expected to fetch data from a single API Endpoint. The Bot detected that you configured the Record Properties referencing API Data Fields nodes that belongs to different API Endpoints. This is not supported and the API Data Fetcher bot will not proceed until you reference a set of API Response Fields that are descendants / belongs to a single API Endpoint.",
"updated": 1621860822884
},
"paragraphs": [
{
"style": "Error",
"text": "More Than Two Endpoints Detected",
"updated": 1621860374194
},
{
"style": "Title",
"text": "Error Info"
},
{
"style": "Text",
"text": "In the following section, you will find the information recorded when the error occurred."
},
{
"style": "Text",
"text": "You will only see the information if you opened this page as a result of the error actually occurring.",
"updated": 1611680880668
},
{
"style": "Subtitle",
"text": "Error Message"
},
{
"style": "Text",
"text": "The following is the Error Message of the Exception that occured at the API Data Fetcher Bot:"
},
{
"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 API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorStack"
},
{
"style": "Subtitle",
"text": "Error Code"
},
{
"style": "Text",
"text": "The following is the Error Code of the Exception that occured at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorCode"
},
{
"style": "Subtitle",
"text": "Error Details"
},
{
"style": "Text",
"text": "The following are all the Error details of the Exception that occured at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorDetails"
},
{
"style": "Subtitle",
"text": "Node Name"
},
{
"style": "Text",
"text": "The following is the node's name of the Node most related to this error:"
},
{
"style": "Placeholder",
"text": "nodeName"
},
{
"style": "Subtitle",
"text": "Node Code"
},
{
"style": "Text",
"text": "The following is the code stored at the node that produced the error at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "nodeCode"
}
]
}
@@ -0,0 +1,101 @@
{
"topic": "TS API Data Fetcher Bot Error",
"pageNumber": "8",
"type": "TS API Data Fetcher Bot Error - API Endpoint Not Found",
"definition": {
"text": "The API Data Fetcher Bot could not establish which is the API Endpoint where it has to fetch data from. This could happen if for instance, the Record Properties don't have any API Response Field Reference child nodes or if they have, these nodes are not referencing any API Response Field nodes. In those situations, the Bot can not know which API Endpoint it needs to connect to. Once at least one API Response Field node is referenced, the Bot will look upwards to it's parent, and grand parents until it finds the API Endpoint it will use to fetch data from.",
"updated": 1621860822884
},
"paragraphs": [
{
"style": "Error",
"text": "More Than Two Endpoints Detected",
"updated": 1621860374194
},
{
"style": "Title",
"text": "Error Info"
},
{
"style": "Text",
"text": "In the following section, you will find the information recorded when the error occurred."
},
{
"style": "Text",
"text": "You will only see the information if you opened this page as a result of the error actually occurring.",
"updated": 1611680880668
},
{
"style": "Subtitle",
"text": "Error Message"
},
{
"style": "Text",
"text": "The following is the Error Message of the Exception that occured at the API Data Fetcher Bot:"
},
{
"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 API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorStack"
},
{
"style": "Subtitle",
"text": "Error Code"
},
{
"style": "Text",
"text": "The following is the Error Code of the Exception that occured at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorCode"
},
{
"style": "Subtitle",
"text": "Error Details"
},
{
"style": "Text",
"text": "The following are all the Error details of the Exception that occured at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorDetails"
},
{
"style": "Subtitle",
"text": "Node Name"
},
{
"style": "Text",
"text": "The following is the node's name of the Node most related to this error:"
},
{
"style": "Placeholder",
"text": "nodeName"
},
{
"style": "Subtitle",
"text": "Node Code"
},
{
"style": "Text",
"text": "The following is the code stored at the node that produced the error at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "nodeCode"
}
]
}
@@ -0,0 +1,101 @@
{
"topic": "TS API Data Fetcher Bot Error",
"pageNumber": "9",
"type": "TS API Data Fetcher Bot Error - Unexpected API Response Code",
"definition": {
"text": "The API response included a response / status code that was not expected by the API Map definitions. Each API Query Response node at the API Endpoint needs to have a config property called codeName with a value equals to the response code sent by the API server. For instance, 200 is the standard OK response, but the server might have another code or this call might have produced an unconventional response from the API server with a different response code that the API Map did not expect. To solve this issue, you need to add a new a new API Query Response node with a config property equal to the code received (you can see it in the details below) in order for the API Data Fetcher Bot to know what to do when this happens. You also need to define this node children.",
"updated": 1621860822884
},
"paragraphs": [
{
"style": "Error",
"text": "Unexpected API Response Code",
"updated": 1621860374194
},
{
"style": "Title",
"text": "Error Info"
},
{
"style": "Text",
"text": "In the following section, you will find the information recorded when the error occurred."
},
{
"style": "Text",
"text": "You will only see the information if you opened this page as a result of the error actually occurring.",
"updated": 1611680880668
},
{
"style": "Subtitle",
"text": "Error Message"
},
{
"style": "Text",
"text": "The following is the Error Message of the Exception that occured at the API Data Fetcher Bot:"
},
{
"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 API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorStack"
},
{
"style": "Subtitle",
"text": "Error Code"
},
{
"style": "Text",
"text": "The following is the Error Code of the Exception that occured at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorCode"
},
{
"style": "Subtitle",
"text": "Error Details"
},
{
"style": "Text",
"text": "The following are all the Error details of the Exception that occured at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorDetails"
},
{
"style": "Subtitle",
"text": "Node Name"
},
{
"style": "Text",
"text": "The following is the node's name of the Node most related to this error:"
},
{
"style": "Placeholder",
"text": "nodeName"
},
{
"style": "Subtitle",
"text": "Node Code"
},
{
"style": "Text",
"text": "The following is the code stored at the node that produced the error at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "nodeCode"
}
]
}
@@ -0,0 +1,101 @@
{
"topic": "TS API Data Fetcher Bot Error",
"pageNumber": "10",
"type": "TS API Data Fetcher Bot Error - Unsupported Dataset Type",
"definition": {
"text": "We have 2 ways of saving data coming from an API. As a Single-File and as One Minute Daily Files. Which one we are going to use depends on the way the dataset is configured. The config property codeName defines the dataset type for that dataset. The 2 supported dataset types that the API Data Fetcher Bot knows are Single-File and One-Min. Use one of those in order to fix this issue. Find below which dataset type the Bot found at runtime.",
"updated": 1621860822884
},
"paragraphs": [
{
"style": "Error",
"text": "Unsupported Dataset Type",
"updated": 1621860374194
},
{
"style": "Title",
"text": "Error Info"
},
{
"style": "Text",
"text": "In the following section, you will find the information recorded when the error occurred."
},
{
"style": "Text",
"text": "You will only see the information if you opened this page as a result of the error actually occurring.",
"updated": 1611680880668
},
{
"style": "Subtitle",
"text": "Error Message"
},
{
"style": "Text",
"text": "The following is the Error Message of the Exception that occured at the API Data Fetcher Bot:"
},
{
"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 API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorStack"
},
{
"style": "Subtitle",
"text": "Error Code"
},
{
"style": "Text",
"text": "The following is the Error Code of the Exception that occured at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorCode"
},
{
"style": "Subtitle",
"text": "Error Details"
},
{
"style": "Text",
"text": "The following are all the Error details of the Exception that occured at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorDetails"
},
{
"style": "Subtitle",
"text": "Node Name"
},
{
"style": "Text",
"text": "The following is the node's name of the Node most related to this error:"
},
{
"style": "Placeholder",
"text": "nodeName"
},
{
"style": "Subtitle",
"text": "Node Code"
},
{
"style": "Text",
"text": "The following is the code stored at the node that produced the error at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "nodeCode"
}
]
}
@@ -0,0 +1,101 @@
{
"topic": "TS API Data Fetcher Bot Error",
"pageNumber": "11",
"type": "TS API Data Fetcher Bot Error - Timestamp Record Property Missing",
"definition": {
"text": "The API Data Fetcher Bot expects that one of the Repord Property nodes is defined with a config property codeName as a timestamp. This is a special value and concept. This means that the Record Property will hold the timestamp value returned by the API, but at the same time it assures the Bot that the information will be well organized by time. To solve this issue simply make sure that you have a Timestamp Record Property that ultimately references the Timestamp API Response Field holding the actual timestamp of the information returned by the API server.",
"updated": 1621860822884
},
"paragraphs": [
{
"style": "Error",
"text": "Timestamp Record Property Missing",
"updated": 1621860374194
},
{
"style": "Title",
"text": "Error Info"
},
{
"style": "Text",
"text": "In the following section, you will find the information recorded when the error occurred."
},
{
"style": "Text",
"text": "You will only see the information if you opened this page as a result of the error actually occurring.",
"updated": 1611680880668
},
{
"style": "Subtitle",
"text": "Error Message"
},
{
"style": "Text",
"text": "The following is the Error Message of the Exception that occured at the API Data Fetcher Bot:"
},
{
"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 API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorStack"
},
{
"style": "Subtitle",
"text": "Error Code"
},
{
"style": "Text",
"text": "The following is the Error Code of the Exception that occured at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorCode"
},
{
"style": "Subtitle",
"text": "Error Details"
},
{
"style": "Text",
"text": "The following are all the Error details of the Exception that occured at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "errorDetails"
},
{
"style": "Subtitle",
"text": "Node Name"
},
{
"style": "Text",
"text": "The following is the node's name of the Node most related to this error:"
},
{
"style": "Placeholder",
"text": "nodeName"
},
{
"style": "Subtitle",
"text": "Node Code"
},
{
"style": "Text",
"text": "The following is the code stored at the node that produced the error at the API Data Fetcher Bot:"
},
{
"style": "Placeholder",
"text": "nodeCode"
}
]
}
@@ -99,8 +99,11 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
let protocol = "https" // default value
if (apiMap.config.hostName === undefined || apiMap.config.hostName === "") {
// TODO Error Handling
return
throwHandledException(
{missingProperty: "hostName"},
'Config Property Missing',
apiMap
)
} else {
hostName = apiMap.config.hostName
}
@@ -118,12 +121,18 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
}
if (apiMap.apiVersions.length === 0) {
// TODO Error Handling
return
throwHandledException(
undefined,
'API Version Node Missing',
apiMap
)
}
if (processNode.processOutput === undefined) {
// TODO Error Handling
return
throwHandledException(
undefined,
'Process Output Node Missing',
processNode
)
}
/*
Process Output Datasets determine which Datasets are going to be built by
@@ -179,8 +188,11 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
to a certain enpoint.
*/
if (endpointNodeFound === undefined) {
// TODO Error Handling
return
throwHandledException(
undefined,
'API Response Field Not Descendant From Endpoint',
apiResponseField
)
}
if (endpointNode === undefined) {
@@ -192,17 +204,30 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
Here we check all enpoints are actually the same endpoiht.
*/
if (endpointNodeFound.id !== endpointNode.id) {
// TODO Error Handling - we can not reference fields from different enpoints.
return
/*
We can not reference fields from different enpoints.
*/
throwHandledException(
undefined,
'More Than Two Endpoints Detected',
apiResponseField
)
}
}
}
}
if (endpointNode === undefined) {
// TODO ERROR HANDLING.
console.log("API Endpoint counld not be found. Check that the at least one Record Property has an API Response Field Reference child, and that this one is referencing an API Response Field.")
throw ("Cant continue")
/*
API Endpoint counld not be found. Check that the at least one Record Property
has an API Response Field Reference child, and that this one is referencing an
API Response Field.
*/
throwHandledException(
undefined,
'API Endpoint Not Found',
productDefinition.record
)
}
}
@@ -427,10 +452,12 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
getApiResponseSchema(response.statusCode)
if (apiResponseSchemaNode === undefined) {
// TODO Error Handling
console.log('The response code ' + response.statusCode + ' received is not associated with any API Response Schema.')
errorCodeReceived = true
return
throwHandledException(
{ resposeCodeReceived: response.statusCode, detais: 'The response code ' + response.statusCode + ' received is not associated with any API Query Response node.' },
'Unexpected API Response Code',
apiResponseSchemaNode
)
}
function onDataArrived(chunk) {
@@ -549,7 +576,11 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
break
}
default: {
// TODO ERROR HANDLING. Unrecognized dataset codeName found.
throwHandledException(
{ datasetType: dataset.config.codeName},
'Unsupported Dataset Type',
dataset
)
}
}
@@ -721,8 +752,14 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) {
let timestamp = record.map.get('timestamp')
if (timestamp === undefined) {
// TODO ERROR HANDLER : There must be a Record Property with codeName 'timestamp' defined.
throw 'ERROR'
/*
There must be a Record Property with codeName 'timestamp' defined.
*/
throwHandledException(
undefined,
'Timestamp Record Property Missing',
productDefinition.record
)
}
return timestamp