Skip to content

Commit

Permalink
Fix error handling in generate-question endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
UO285267 committed Mar 10, 2024
1 parent 022e5e6 commit 643e776
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions gatewayservice/gateway-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ app.post('/adduser', async (req, res) => {
app.get('/generate-question', async (req, res) => {
try {
// Forward the generate question request to the question service
const questionResponse = await axios.get(questionServiceUrl + '/generate-question');
const questionResponse = await axios.get(questionServiceUrl+'/generate-question');
res.json(questionResponse.data);
} catch (error) {
res.status((error.response && error.response.status) || 500).json({
error: (error.response && error.response.data && error.response.data.error) || 'Internal Server Error',
});
res.status(error.response.status).json({ error: error.response.data.error });
}
});

Expand Down

0 comments on commit 643e776

Please sign in to comment.