Skip to content

Commit 5016f0a

Browse files
committed
Add improved error message on communication error
1 parent 77e30e2 commit 5016f0a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

controllers/meilisearch.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ async function sendCtx (ctx, fct) {
1919
ctx.send(body)
2020
} catch (e) {
2121
console.error(e)
22+
const message = (e.type === 'MeiliSearchCommunicationError')
23+
? `Could not connect with MeiliSearch ${e.code}`
24+
: `${e.type}: \n${e.message || e.code}`
2225
return {
2326
error: true,
24-
message: `${e.type}: \n${e.message || e.code}`,
25-
...(e.errorLink ? { link: e.errorLink } : {})
27+
message,
28+
link: e.errorLink
2629
}
2730
}
2831
}

0 commit comments

Comments
 (0)