improved error loggin and updated imports to fix build failure
This commit is contained in:
@@ -45,9 +45,9 @@ ApiProxy.get(async (req, res) => {
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(consoleLogger(err));
|
||||
res.status(400).json(err);
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
res.status(400).json(error);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -246,8 +246,8 @@ export default async function handler(req, res) {
|
||||
path: `${caseRef}/${reqBodyobj.repfile_name}/files/${reqBodyobj.repfile_name}.pdf`,
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
consoleLogger(err);
|
||||
res.status(400).json(err);
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
res.status(400).json(error);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ export default async function ApiProxy(req, res) {
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
consoleLogger(err);
|
||||
res.status(400).json(err);
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
res.status(400).json(error);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -49,15 +49,19 @@ ApiProxy.get(async (req, res) => {
|
||||
"&casefolderID=" +
|
||||
casefolderID;
|
||||
|
||||
//console.log(hashAPIPath(checkquerypath), checkHash);
|
||||
//console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
|
||||
// console.log("-----", casefolderID);
|
||||
// console.log("-----", req.query);
|
||||
// console.log("-----", checkquerypath);
|
||||
// console.log("-----", hashAPIPath(checkquerypath));
|
||||
// console.log("-----", checkHash);
|
||||
// console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
|
||||
|
||||
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||
await getBlobs(containerName, casefolderID).then((data) => {
|
||||
return res.status(200).json({ "value": [data] });
|
||||
});
|
||||
} else {
|
||||
return res.status(400).json({ "error": "ooops" });
|
||||
return res.status(400).json();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -21,8 +21,12 @@ ApiProxy.get(async (req, res) => {
|
||||
"&casefolderID=" +
|
||||
casefolderID;
|
||||
|
||||
//console.log(hashAPIPath(checkquerypath), checkHash);
|
||||
//console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
|
||||
// console.log("-----", casefolderID);
|
||||
// console.log("-----", req.query);
|
||||
// console.log("-----", checkquerypath);
|
||||
// console.log("-----", hashAPIPath(checkquerypath));
|
||||
// console.log("-----", checkHash);
|
||||
// console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash);
|
||||
|
||||
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||
const blobObj = await getProgressBlobs(containerName, casefolderID)
|
||||
|
||||
@@ -58,15 +58,9 @@ ApiProxy.get(async (req, res) => {
|
||||
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||
const blobObj = await getRepsBlobs(containerName, casefolderID)
|
||||
.then(async (data) => {
|
||||
//console.log(
|
||||
// "\n////////////////////////////\n getRepsBlobs:",
|
||||
// data
|
||||
// );
|
||||
return data;
|
||||
})
|
||||
.then(async (data) => {
|
||||
//console.log("\n////////////////////////////\n now here:", data);
|
||||
|
||||
let result = await downloadAllRepsFiles(containerName, data);
|
||||
|
||||
return res
|
||||
@@ -75,17 +69,10 @@ ApiProxy.get(async (req, res) => {
|
||||
.json(result);
|
||||
})
|
||||
.catch((error) => {
|
||||
//console.log(
|
||||
// "///////////////////////\ngetRepsFromBlob api in api route response: " +
|
||||
// error +
|
||||
// "\n///////////////////////\n"
|
||||
// );
|
||||
//console.log("API call error", error);
|
||||
|
||||
console.log(consoleLogger(error));
|
||||
consoleLogger(error);
|
||||
});
|
||||
} else {
|
||||
return res.status(400).json({ msg: "error" });
|
||||
return res.status(400).json();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ export default async function ApiProxy(req, res) {
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
consoleLogger(err);
|
||||
res.status(400).json(err);
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
res.status(400).json(error);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,13 +23,11 @@ ApiProxy.get(async (req, res) => {
|
||||
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||
await createContainer(containerName)
|
||||
.then((data) => {
|
||||
//console.log("has response:", data);
|
||||
return res.status(200).json({ data: "success" });
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
console.log(consoleLogger(err));
|
||||
res.status(400).json(err);
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
res.status(400).json(error);
|
||||
});
|
||||
} else {
|
||||
return res.status(400).json();
|
||||
|
||||
@@ -37,7 +37,7 @@ export default async function ApiProxy(req, res) {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*"',
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Authorization": "Bearer " + token.access_token,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
@@ -51,6 +51,7 @@ export default async function ApiProxy(req, res) {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
res.status(400);
|
||||
consoleLogger(error);
|
||||
res.status(400).json(error);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user