We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ce655a5 commit 6ca25edCopy full SHA for 6ca25ed
1 file changed
src/index.js
@@ -47,9 +47,21 @@ const solrPost = config => path => async data => {
47
)
48
}
49
50
- const response = await axios.post(solrUrl, data, {
51
- headers: { "Content-Type": "application/json" }
52
- })
+ const response = await axios
+ .post(solrUrl, data, {
+ headers: { "Content-Type": "application/json" }
53
+ })
54
+ .catch(reason => {
55
+ // converting error response from solr
56
+ switch (reason.response.status) {
57
+ case 400:
58
+ throw Error(reason.response.data.error.msg)
59
+ case 404:
60
+ throw Error(`${reason.message}: ${reason.response.statusText}`)
61
+ default:
62
+ throw reason
63
+ }
64
65
66
return response.data
67
0 commit comments