Repository: sunpy/sunpy

Issue:
Return VSO errors to the user
Currently we hide any VSO error codes from the user at Search time. If there is a reliable way we can extract this info we should throw warnings or similar.

From #3331 we can see that under certain conditions we get an error key in the returned XML from the VSO:
```
DEBUG: VSO Response:
 <soap:Envelope xmlns:VSO="http://virtualsolar.org/VSO/VSOi" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soap:Body>
    <VSO:QueryResponse>
      <body>
        <provideritem>
          <error>VSO-D404 Bad Request -- Invalid Time Sample : contains non digit</error>
          <provider>SSC</provider>
          <version>1</version>
        </provideritem>
      </body>
    </VSO:QueryResponse>
  </soap:Body>
</soap:Envelope>
```

The question here is, is this layout consistent over all providers and error types the VSO might throw back at us, so should we be parsing this and raising it as a warning during `VSOClient.search`.


Discussion:
From speaking to VSO folk, to parse this we should check to see if there is a `<error>` key in the `<provideritem>` and if there is return the contents of the error key. `<provider>` will only exist if the error is from the provider rather than the VSO core.

There are docs on the VSO error code (in this case `D404`), both for the [letter](https://sdac.virtualsolar.org/cgi/show_details?keyword=STATUS_TYPE) and [number](https://sdac.virtualsolar.org/cgi/show_details?keyword=STATUS_LONG)

There is also apparently sometimes a  `<status>` key in a provider item. Which usefully contains if JSOC has gone into summary mode. We should *definitely* be raising this as a SunPy warning.

```
        <provideritem>
          <provider>JSOC</provider>
          <record/>
          <status>Large Query (over 5000 records); Summary rows returned; Each record describes multiple observations</status>
          <no_of_records_found xsi:nil="true"/>
          <version>1</version>
          <no_of_records_returned>0</no_of_records_returned>
        </provideritem>
```
I would like to work upon this issue
@jains8844 go ahead, you don't need permission to work on open issues.
I was going through the JSOC one. The page [https://docs.virtualsolar.org/wiki/DataProviderJSOC_SHA#no1](https://docs.virtualsolar.org/wiki/DataProviderJSOC_SHA#no1) shows that JSOC provider serves data for AIA and HMI instruments.
I tried 
`client.search(vso.attrs.Time(datetime(2010, 1, 1), datetime(2010, 1, 1, 1)),vso.attrs.Instrument('aia'))` 
but it results into an `XMLParseError` from zeep client `Unexpected element 's-gensym3'` and the same thing happens on HMI too. So I cannot really access the jsoc data.
                resp=self.api.service.Query(
                        QueryRequest(block=block)
                    )
                for i in resp:
                    if(i['error']):
                        warnings.warn(i['error'], SunpyUserWarning)
                responses.append(
                    VSOQueryResponse(resp)
                )

For VSO replacing [https://github.com/sunpy/sunpy/blob/master/sunpy/net/vso/vso.py#L367](https://github.com/sunpy/sunpy/blob/master/sunpy/net/vso/vso.py#L367) with something like the code above would raise a `SunpyUserWarning` of the error message recieved. Would it suffice ?
Any comments ?? 
Implement it, open a PR and we can discuss it there. 
Okay

Resolving patch:
diff --git a/sunpy/net/vso/vso.py b/sunpy/net/vso/vso.py
--- a/sunpy/net/vso/vso.py
+++ b/sunpy/net/vso/vso.py
@@ -364,11 +364,15 @@ def search(self, *query):
         responses = []
         for block in walker.create(query, self.api):
             try:
+                query_response = self.api.service.Query(
+                    QueryRequest(block=block)
+                    )
+                for resp in query_response:
+                    if resp["error"]:
+                        warnings.warn(resp["error"], SunpyUserWarning)
                 responses.append(
-                    VSOQueryResponse(self.api.service.Query(
-                        QueryRequest(block=block)
-                    ))
-                )
+                    VSOQueryResponse(query_response)
+                    )
             except Exception as ex:
                 response = QueryResponse.create(self.merge(responses))
                 response.add_error(ex)


Test patch:
diff --git a/sunpy/net/tests/test_fido.py b/sunpy/net/tests/test_fido.py
--- a/sunpy/net/tests/test_fido.py
+++ b/sunpy/net/tests/test_fido.py
@@ -25,6 +25,7 @@
 from sunpy.net.vso.vso import DownloadFailed
 from sunpy.time import TimeRange, parse_time
 from sunpy.util.datatype_factory_base import MultipleMatchError
+from sunpy.util.exceptions import SunpyUserWarning
 from sunpy.tests.helpers import skip_windows
 
 TIMEFORMAT = config.get("general", "time_format")
@@ -229,6 +230,22 @@ def test_vso_unifiedresponse():
     assert isinstance(uresp, UnifiedResponse)
 
 
+@pytest.mark.remote_data
+def test_vso_error():
+    with pytest.warns(SunpyUserWarning,
+        match="VSO-D404 Bad Request -- Invalid Time Sample : contains non digit"):
+        Fido.search(
+            a.Time('2012-03-04','2012-03-06'),
+            a.Instrument("EUVI"),
+            a.Wavelength(304*u.AA), a.Sample(100*u.min))
+
+    with pytest.warns(SunpyUserWarning,
+        match="VSO-C500 :soap:Server.Transport : 404 Not Found"):
+        Fido.search(
+            a.Time('2019/12/30', '2019/12/31'),
+            a.Instrument('ovsa'))
+
+
 @pytest.mark.remote_data
 def test_responses():
     results = Fido.search(