ilmanzo/package_last_update

Handle errors on network offline / dns resolution

Closed this issue · 9 comments

when offline, now the program ends with

<urllib3.connection.HTTPSConnection object at 0x7fbd7cd74520>: Failed to establish a new connection: [Errno -2] Name or service not known

Handle exception and give a more user friendly error message

Hello 👋. I would like to contribute and help to handle the exception and provide a more user friendly error message.

As this is my very first. Please how do I go about this.

Hello, thanks for your interest. The main idea is to give the user a useful error when the network is disconnected or the service is not reachable. There are two main places where this can happen, one is on the spawn of the external osc process and the other is when we directly send requests.get to repology webservice , so probably you need to wrap each one in a separate manner inside a try/except. Feel free to make a PR with a proposal, I have assigned this issue to you :)

Okay, I would make a pull request with a proposal.

Thanks

I have made a pull request

looks on the good track, thanks! I'd ask also to take care of the errors when the user runs the bash script instead of the helper program.

./shouldIupdate.sh 
<urllib3.connection.HTTPSConnection object at 0x7f5f91dec520>: Failed to establish a new connection: [Errno -2] Name or service not known

this error is probably caused by the $(osc -A https://api.opensuse.org my packages) call

I would look into it

I have the second pull request.

The changes I made was to check if the "osc" command was available and also redirected the 'stderr' message to 'stdout'. Exiting the program if the message==
<urllib3.connection.HTTPSConnection object at 0x7f5f91dec520>: Failed to establish a new connection: [Errno -2] Name or service not known

thanks for the contribution!