Handling no connection

When there is no internet, the code will return an error with the error
message.