added try catch around sparql query for malformed queries
This commit is contained in:
parent
b4c2a0c88d
commit
59bb42be11
1 changed files with 25 additions and 18 deletions
|
@ -241,6 +241,7 @@ app.post("/UploadMetafile", upload.single('file'), (req, res) => {
|
|||
app.post('/sparql', (req, res) => {
|
||||
console.log(req.body);
|
||||
const start = async function () {
|
||||
try {
|
||||
let result = [];
|
||||
const bindingsStream = await myEngine.queryBindings(
|
||||
req.body,
|
||||
|
@ -261,8 +262,14 @@ app.post('/sparql', (req, res) => {
|
|||
bindingsStream.on('error', (err) => {
|
||||
console.error(err);
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.json("Error occured while querying");
|
||||
}
|
||||
};
|
||||
|
||||
start()
|
||||
|
||||
});
|
||||
|
||||
///////////////////////////////////////////////////////////Integration///////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue