core icon indicating copy to clipboard operation
core copied to clipboard

Feat: Exception handling

Open Fadarrizz opened this issue 10 months ago • 2 comments

This PR adds exception handling to the downloader and allows middleware to act upon caught exceptions.

Personally, I need this for handling Javascript (Browsershot) exceptions, so I can retry them. In order to act upon thrown exceptions during the request being sent, exception handling is needed at the downloader level.

Fadarrizz avatar Mar 23 '25 20:03 Fadarrizz

There is one problem I'm still solving: throwing the exception when it hasn't been handled.

Fadarrizz avatar Apr 16 '25 18:04 Fadarrizz

@ksassnowski I implemented a feature that throws exceptions when they are not handled by any middleware.

To achieve this, we need to track whether an exception has been handled, so I decided to wrap exceptions with a RequestException and maintain the handled state within that class.

I would appreciate it if you could review this and share your feedback!

Fadarrizz avatar Apr 26 '25 10:04 Fadarrizz