Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reader.ParseArticle will raise weird HttpRequestException exception #60

Open
doggy8088 opened this issue Mar 26, 2024 · 2 comments
Open

Comments

@doggy8088
Copy link

doggy8088 commented Mar 26, 2024

For this code:

Article article = Reader.ParseArticle(url);

If request to the url returned HTTP 403 Forbidden, it will raise HttpRequestException exception. The exception object will contains a .StatusCude property but the value will be (null), and the .Message property will contains Cannot GET resource <URL>. StatusCode: Forbidden. That's not what I expected.

@gabriele-tomassetti
Copy link
Member

Thanks for reporting the issue. I will work on fixing it this weekend.

@gabriele-tomassetti
Copy link
Member

There is an old issue related to this Exception: Raise a clear exception on non-successful http status code and document it. They wanted to have a custom SmartReader-based exception or document the current exception the library raises. We now document the exception.

However, maybe we should change the way we handle fail cases, given that a few people are surprised by our current approach. For instance, we could catch all exceptions and add some message to Article to indicate a failure in retrieving the article. What do you suggest? What would you want to happen instead of throwing an exception?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants