aboutsummaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2023-06-17 02:48:36 +0300
committerkaotisk <kaotisk@arching-kaos.org>2023-06-17 02:48:36 +0300
commit77c9edf809cac2e9577e1b9de5236fd6de6be578 (patch)
tree14d995609699f9b839ae53a3b046cdad638d324c /api
parent01ff1c0a97cd36e69e21bac0776bef21be7ae374 (diff)
downloadarching-kaos-tools-77c9edf809cac2e9577e1b9de5236fd6de6be578.tar.gz
arching-kaos-tools-77c9edf809cac2e9577e1b9de5236fd6de6be578.tar.bz2
arching-kaos-tools-77c9edf809cac2e9577e1b9de5236fd6de6be578.zip
API: Error response errno -> error
Diffstat (limited to 'api')
-rwxr-xr-xapi/index.js12
-rw-r--r--api/routes/getInnerIPFSContent/index.js6
-rw-r--r--api/routes/getZblock/index.js6
-rw-r--r--api/routes/index.js2
-rw-r--r--api/routes/receiveZBlock/index.js6
-rw-r--r--api/routes/receiveZChain/index.js10
-rw-r--r--api/validators/ZblockValidator/index.js6
-rw-r--r--api/validators/ZchainValidator/index.js6
8 files changed, 27 insertions, 27 deletions
diff --git a/api/index.js b/api/index.js
index cb6006a..d9f243f 100755
--- a/api/index.js
+++ b/api/index.js
@@ -103,7 +103,7 @@ app.use('/', routes);
* of the application that run the test.
*
* Returns:
- * - errno on failure
+ * - error on failure
* - on success we process with addNSEntriesToFile()
*
*/
@@ -115,7 +115,7 @@ function continuethingsNS(validitycode,sh,res,gotit){
};
addNSEntriesToFile(entry,res);
} else {
- res.send({errno:"Invalid data"});
+ res.send({error:"Invalid data"});
}
}
@@ -124,7 +124,7 @@ function continuethingsNS(validitycode,sh,res,gotit){
* of the application that run the test.
*
* Returns :
- * - errno on failure
+ * - error on failure
* - on success we process with addEntriesToFile()
*
*/
@@ -133,7 +133,7 @@ function continuethings(exitcode,sh,res){
var entry = {zblock:sh};
addEntriesToFile(entry,res);
} else {
- res.send({errno:"Invalid data"});
+ res.send({error:"Invalid data"});
}
}
@@ -156,7 +156,7 @@ function addNSEntriesToFile(entry,res){
data.forEach(a=>{
if ( a.zchain === entry.zchain && a.latest=== entry.latest ){
duplicate_entry = 1;
- res.send({errno:"already there"});
+ res.send({error:"already there"});
}
});
@@ -200,7 +200,7 @@ function addEntriesToFile(entry,res){
data.forEach(a=>{
if ( a.zblock === entry.zblock ){
duplicate_entry = 1;
- res.send({errno:"already there"});
+ res.send({error:"already there"});
}
});
diff --git a/api/routes/getInnerIPFSContent/index.js b/api/routes/getInnerIPFSContent/index.js
index 555d2a3..e17d038 100644
--- a/api/routes/getInnerIPFSContent/index.js
+++ b/api/routes/getInnerIPFSContent/index.js
@@ -19,14 +19,14 @@ module.exports = (req, res) => {
regex= /Qm[A-Za-z0-9]{44}/;
if (regex.test(req.query.ipfs)){
if (req.query.ipfs === "QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH" ){
- res.send({errno:"Genesis block"});
+ res.send({error:"Genesis block"});
} else {
fetchZblock(req.query.ipfs,res);
}
} else {
- res.send({errno:"Invalid data: regexp failed to pass"});
+ res.send({error:"Invalid data: regexp failed to pass"});
}
} else {
- res.send({errno:"Invalid data: no valid zblock was provided"});
+ res.send({error:"Invalid data: no valid zblock was provided"});
}
}
diff --git a/api/routes/getZblock/index.js b/api/routes/getZblock/index.js
index 67626d6..7787d23 100644
--- a/api/routes/getZblock/index.js
+++ b/api/routes/getZblock/index.js
@@ -46,14 +46,14 @@ module.exports = (req, res) => {
regex= /Qm[A-Za-z0-9]{44}/;
if (regex.test(req.query.zblock)){
if (req.query.zblock === "QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH" ){
- res.send({errno:"Genesis block"});
+ res.send({error:"Genesis block"});
} else {
fetchZblock(req.query.zblock,res);
}
} else {
- res.send({errno:"Invalid data: regexp failed to pass"});
+ res.send({error:"Invalid data: regexp failed to pass"});
}
} else {
- res.send({errno:"Invalid data: no valid zblock was provided"});
+ res.send({error:"Invalid data: no valid zblock was provided"});
}
}
diff --git a/api/routes/index.js b/api/routes/index.js
index 9a6f433..c019967 100644
--- a/api/routes/index.js
+++ b/api/routes/index.js
@@ -48,5 +48,5 @@ router.route(settings.URL_PREFIX+'/sblk').post(receiveZBlock);
// Send a zchain link to the node (refering to a valid zchain out there)
router.route(settings.URL_PREFIX+'/szch').post(receiveZChain);
-router.route('/*').get((req,res)=>{console.log(req.url);res.send({errno:"404"})});
+router.route('/*').get((req,res)=>{console.log(req.url);res.send({error:"404"})});
module.exports = router;
diff --git a/api/routes/receiveZBlock/index.js b/api/routes/receiveZBlock/index.js
index 3ad6100..4f1ae3d 100644
--- a/api/routes/receiveZBlock/index.js
+++ b/api/routes/receiveZBlock/index.js
@@ -7,7 +7,7 @@
* 3. Matches regular expression /Qm[A-Za-z0-9]{44}/
*
* Returns:
- * - errno on failure
+ * - error on failure
* - on success the string is processed for further
* validation to the function getvalidity()
*
@@ -20,9 +20,9 @@ module.exports = (req, res) => {
if (regex.test(req.body.zblock)){
getvalidity(req.body.zblock,res);
} else {
- res.send({errno:"Invalid data"});
+ res.send({error:"Invalid data"});
}
} else {
- res.send({errno:"Invalid data"});
+ res.send({error:"Invalid data"});
}
}
diff --git a/api/routes/receiveZChain/index.js b/api/routes/receiveZChain/index.js
index 6915842..a955b79 100644
--- a/api/routes/receiveZChain/index.js
+++ b/api/routes/receiveZChain/index.js
@@ -3,7 +3,7 @@
* of the application that run the test.
*
* Returns:
- * - errno on failure
+ * - error on failure
* - on success we process with addNSEntriesToFile()
*
*/
@@ -15,7 +15,7 @@ function continuethingsNS(validitycode,sh,res,gotit){
};
addNSEntriesToFile(entry,res);
} else {
- res.send({errno:"Invalid data"});
+ res.send({error:"Invalid data"});
}
}
/*
@@ -27,7 +27,7 @@ function continuethingsNS(validitycode,sh,res,gotit){
* 3. Matches regular expression /k51qzi5uqu5d[A-Za-z0-9]{50}/
*
* Returns:
- * - errno on failure
+ * - error on failure
* - on success the string is processed for further validation to the
* function getNSvalidity()
*
@@ -40,9 +40,9 @@ module.exports = (req, res) => {
if (regex.test(req.body.zchain)){ // && regex.test(req.body.block_signature)){
getNSvalidity(req.body.zchain,res);
} else {
- res.send({errno:"Invalid data"});
+ res.send({error:"Invalid data"});
}
} else {
- res.send({errno:"Invalid data"});
+ res.send({error:"Invalid data"});
}
}
diff --git a/api/validators/ZblockValidator/index.js b/api/validators/ZblockValidator/index.js
index 2fd9aef..873a971 100644
--- a/api/validators/ZblockValidator/index.js
+++ b/api/validators/ZblockValidator/index.js
@@ -26,7 +26,7 @@ function addEntriesToFile(entry,res){
data.forEach(a=>{
if ( a.zblock === entry.zblock ){
duplicate_entry = 1;
- res.send({errno:"already there"});
+ res.send({error:"already there"});
}
});
@@ -48,7 +48,7 @@ function addEntriesToFile(entry,res){
* of the application that run the test.
*
* Returns :
- * - errno on failure
+ * - error on failure
* - on success we process with addEntriesToFile()
*
*/
@@ -57,7 +57,7 @@ function continuethings(exitcode,sh,res){
var entry = {zblock:sh};
addEntriesToFile(entry,res);
} else {
- res.send({errno:"Invalid data"});
+ res.send({error:"Invalid data"});
}
}
/*
diff --git a/api/validators/ZchainValidator/index.js b/api/validators/ZchainValidator/index.js
index 90cdb35..f4080d0 100644
--- a/api/validators/ZchainValidator/index.js
+++ b/api/validators/ZchainValidator/index.js
@@ -26,7 +26,7 @@ function addEntriesToFile(entry,res){
data.forEach(a=>{
if ( a.zblock === entry.zblock ){
duplicate_entry = 1;
- res.send({errno:"already there"});
+ res.send({error:"already there"});
}
});
@@ -48,7 +48,7 @@ function addEntriesToFile(entry,res){
* of the application that run the test.
*
* Returns :
- * - errno on failure
+ * - error on failure
* - on success we process with addEntriesToFile()
*
*/
@@ -57,7 +57,7 @@ function continuethings(exitcode,sh,res){
var entry = {zblock:sh};
addEntriesToFile(entry,res);
} else {
- res.send({errno:"Invalid data"});
+ res.send({error:"Invalid data"});
}
}
/*