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

validator.rb custom_open throws uncaught SocketError #422

Open
ntli239 opened this issue Oct 15, 2018 · 2 comments
Open

validator.rb custom_open throws uncaught SocketError #422

ntli239 opened this issue Oct 15, 2018 · 2 comments

Comments

@ntli239
Copy link

ntli239 commented Oct 15, 2018

When trying to validate a string that looks like URI, but is not a real one,
the error thrown in custom_open is SocketError, not OpenURI::HTTPError, Timeout::Error.
It is not caught here, but by other more generic app layer, and is not processed properly as a result.
When SocketError is added to the rescue list as a patch, everything works as expected. Could you please update the main code?

@RST-J
Copy link
Contributor

RST-J commented Nov 17, 2018

Could you please provide a failing test case which should pass with the suggested fix?

@ntli239
Copy link
Author

ntli239 commented Dec 28, 2018

Hi RST-J
Sorry about the delay

 data = "http://google.com"
 schema = {
        "type": "String",
         "maxLength": 100
 }
errors = JSON::Validator.fully_validate(schema,data)
assert(errors.empty?)

There is one difference I found though, when running this from CLT: the error thrown is WebMock::NetConnectNotAllowedError, not SocketError I had inside the app.

Thank you!

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