Skip to content

Commit

Permalink
Also log errors if index fails all together
Browse files Browse the repository at this point in the history
  • Loading branch information
runely committed Apr 3, 2022
1 parent f87acfb commit 0b46781
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions UpdateTerms/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,17 @@ const updateTermStore = async (context, req) => {
}
}
} catch (error) {
if (error instanceof HTTPError) return error.toJSON()
if (error instanceof HTTPError) {
logger('error', ['index', error.statusCode, error.message])
return error.toJSON()
}
const status = error.response?.status || 500
const errorBody = error.response?.data || error.data || error.message
logger('error', ['index', status, errorBody])
return {
status: error.response?.status || 500,
status,
body: {
error: error.response?.data || error.data || error.message
error: errorBody
}
}
}
Expand Down

0 comments on commit 0b46781

Please sign in to comment.