Commit 3ba5f7ca authored by Markus Opolka's avatar Markus Opolka
Browse files

Add error handling for search

parent d09bf4aa
......@@ -131,8 +131,15 @@ function searchInDocument (document, query) {
/*
* Search for query in (js) document
*/
var flatobject = flat(document.object.TEI)
var results = searchInObject(flatobject, query)
let faltobject = {}
try {
flatobject = flat(document.object.TEI)
} catch (err) {
console.log(arguments.callee) // eslint-disable-line no-caller
console.log('>> Error while searching')
}
var results = searchInObject(flatobject, query)
if (results.length > 0) {
document['results'] = results
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment