switch to use .json instead of .send

Signed-off-by: Emma Indal <emma.indahl@gmail.com>
This commit is contained in:
Emma Indal
2022-06-22 13:39:39 +02:00
parent 741b6df63a
commit 34c97eb35b
4 changed files with 28 additions and 15 deletions
+1 -7
View File
@@ -162,13 +162,7 @@ export async function createRouter(
res.send(filterResultSet(toSearchResults(resultSet)));
} catch (error) {
if (error instanceof MissingIndexError) {
res
.status(400)
.send(
`\nNo index found for types: ${
query.types ? query.types.join(',') : ''
}. This means there are no documents to search through.`,
);
res.status(400).json(error.message);
}
throw new Error(