Catch error wont return on failed

I always wanted to return 200 status code whenever the first fetch code failed but it wont return as expected. The block inside catch wont return for errors and timeouts. Could someone please check my code below?


exports.handler = async function (event, context) {

        var requestOptions = {
            method: 'GET',
            headers: {
                "Content-Type": "application/json",
                Authorization: "Bearer " + process.env.WEBFLOW_KEY,
            },
            redirect: 'follow'
        };

            try {
                
                const res = await fetch("https://api.webflow.com/sites/6435e9c28ff9be5b63fb701d/products/" + id, requestOptions)
                const newres = await res.json();

                return {
                    statusCode: 200,
                    headers: {
                        "Access-Control-Allow-Origin": "*",
                        'content-type': 'application/json',
                    },
                    body: JSON.stringify(newres),
                }
            } catch (error) {

                return {
                    statusCode: 200,
                    headers: {
                        'content-type': 'application/json',
                    },
                    body: JSON.stringify({status: 'error'})
                }

            }

    }

Hey @cyrilnicko,

I think this is the wrong place to ask code-related questions.
Maybe you should ask this on stackoverflow.com.

Gr,

Andy