I want to return a 401 status on an action when a certain error occurs
Hi kapa, i want to return a response of 401 when a certain action fails. In my case my action fetches some information from an external API but when this fails with a 401 status i want to also return a 401 status to the client.
const response = await axios.post(tokenUrl, {}, { headers }); if (response.status === 401) { throw new HttpError(401, 'Bs'); }
const response = await axios.post(tokenUrl, {}, { headers }); if (response.status === 401) { throw new HttpError(401, 'Bs'); }
Right now i do the following above but it throws the error but does still return a 200 to the client.
Recent Announcements
Continue the conversation
Join the Discord to ask follow-up questions and connect with the community
W
Wasp
Rails-like framework for React, Node.js and Prisma. Build your app in a day and deploy it with a single CLI command.