Why not to pass the urllib message through - there may be a difference between unknown host, connection rejected and TCP timeout.
It would be great to include the URL in the error message - some use cases may involve incorrect data to be supplied as the URL, and this would help to quickly debug it.
Could you make a test for the invalid URL case? This should be fairly simple.
add NextCloudConnectionError on connection errors during request to nextcloud