Try, catch block still results in browser error?

I’d like to harden my app from errors. I watched @mark-piller video on error handling but am not getting the expected results.

I am testing how the try, catch block works. My test page makes a get request to a file I know doesn’t exist to replicate an error.

image

The error is caught, I guess, as it is displayed in the console as expected -

But the browser also throws an error. I thought the point of the try, catch was to avoid the error raising to the browser -

Am I not understanding the purpose or outcome of try, catch?

Did I implement try, catch incorrectly?

Ultimately, what is the right way of preventing an error in the event a bad request is made?

Thanks,
Tim

Hello @Tim_Jones,

Your try-catch block is correct, the error is handles as it should.
However, browser will always show the network errors even if they are handled.
You can hide them using filters but they will be present anyway.

Regards,
Olha