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

Any API function can return {:error, :closed} #226

Open
Kukunin opened this issue Nov 5, 2018 · 1 comment
Open

Any API function can return {:error, :closed} #226

Kukunin opened this issue Nov 5, 2018 · 1 comment

Comments

@Kukunin
Copy link

Kukunin commented Nov 5, 2018

When web driver closes a connection (because of a crash or something similar), Hound might return {:error, :closed} literally from every helper function.

It's pretty dangerous since it's pretty unexpected, and it can feed wrong data further into an application.

One example is that Hound.Session.active_sessions() |> Enum.count crashes with (Protocol.UndefinedError) protocol Enumerable not implemented for {:error, :closed}, as in #225

Another example was that it silently returned {:error, :closed} from find_element(:css, "img#iImage") |> attribute_value("src"), causing the other part of system fail, because it expected a string.

It's better to raise exception in such cases, since it's unexpected case, and unexpected output from functions

@Kukunin
Copy link
Author

Kukunin commented Nov 5, 2018

At least, it might be ok to return {:error, :closed} on safe methods, such as search_element. but otherwise I expect it to crash

Kukunin added a commit to Kukunin/hound that referenced this issue Dec 17, 2018
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

1 participant