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

Http input: not managed error 404 #3213

Open
marmack95 opened this issue Jun 28, 2024 · 2 comments
Open

Http input: not managed error 404 #3213

marmack95 opened this issue Jun 28, 2024 · 2 comments

Comments

@marmack95
Copy link

Hello,
I create a very basic model for a specific device : it is almost identical to dlinkcam model.

It work's well, but i notice that HTTP input not manage error: when it don't find the file (error 404), it does not return any error.
It save error as config file... Which let you think during weeks that all it's ok, but it's not.

@ytti
Copy link
Owner

ytti commented Jun 28, 2024

I do wonder whose role is what. What is models role, what is input methods role?

Since obviously in most typical case, we use some CLI like mechanism, like SSH or Telnet, and then we do not have any protocol level notofication about success or failure, so if we want to determine that, then it is obviously model's responsibility to figure it out.

But for HTTP, FTP and others, we can determine some errors, should we raise them, or leave them to model as well?

Could there be use-case, where model wants 404 and wants to act on that? And if we make it error, this use-case cannot be satisfied?

You could of course look at the content of the returned string, and determine it is an error, and then raise error from the model, causing failure for that node to be booked.

@marmack95
Copy link
Author

It's a simple download of file in http.
ixoff.txt

I see that you manage error 401 for authentification cases.

But not any other HTML Error code.
Error 404 (document not found) is the best known.
Error 400 (Bad Request) / 403 (Forbidden) are also frequent.

If i can i manage http code in my model without rewrite all Mechanize code (i do it in Dell Drac model, because i don't find how to do), it's ok for me.
But i don't find how.

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