misc: complete HTTP error message (#73835)
This commit is contained in:
parent
649faf066a
commit
b863dbe750
|
@ -9508,7 +9508,8 @@ def test_form_item_map_data_source(pub, http_requests):
|
|||
resp_geojson = app.get('/api/geojson/foobar', status=400)
|
||||
assert resp_geojson.json == {
|
||||
'err': 1,
|
||||
'err_desc': 'Error retrieving data (Error loading JSON data source (error in HTTP request to (status: 500)))',
|
||||
'err_desc': 'Error retrieving data (Error loading JSON data source '
|
||||
'(error in HTTP request to http://remote.example.net/500 (status: 500)))',
|
||||
'err_class': 'Invalid request',
|
||||
}
|
||||
|
||||
|
|
|
@ -602,15 +602,16 @@ def test_json_datasource_bad_url(pub, error_email, http_requests, emails):
|
|||
assert data_sources.get_items(datasource) == []
|
||||
assert emails.count() == 1
|
||||
assert (
|
||||
'[ERROR] [DATASOURCE] Error loading JSON data source (error in HTTP request to (status: 404))'
|
||||
'[ERROR] [DATASOURCE] Error loading JSON data source '
|
||||
'(error in HTTP request to http://remote.example.net/404 (status: 404))'
|
||||
in emails.get_latest('subject')
|
||||
)
|
||||
assert pub.loggederror_class.count() == 1
|
||||
logged_error = pub.loggederror_class.select()[0]
|
||||
assert logged_error.workflow_id is None
|
||||
assert (
|
||||
logged_error.summary
|
||||
== "[DATASOURCE] Error loading JSON data source (error in HTTP request to (status: 404))"
|
||||
logged_error.summary == "[DATASOURCE] Error loading JSON data source "
|
||||
"(error in HTTP request to http://remote.example.net/404 (status: 404))"
|
||||
)
|
||||
|
||||
datasource = {
|
||||
|
@ -1050,8 +1051,8 @@ def test_geojson_datasource_bad_url(pub, http_requests, error_email, emails):
|
|||
logged_error = pub.loggederror_class.select()[0]
|
||||
assert logged_error.workflow_id is None
|
||||
assert (
|
||||
logged_error.summary
|
||||
== "[DATASOURCE] Error loading JSON data source (error in HTTP request to (status: 404))"
|
||||
logged_error.summary == "[DATASOURCE] Error loading JSON data source "
|
||||
"(error in HTTP request to http://remote.example.net/404 (status: 404))"
|
||||
)
|
||||
|
||||
datasource = {
|
||||
|
|
|
@ -413,7 +413,7 @@ def _http_request(
|
|||
auth_header = response.headers.get('WWW-Authenticate')
|
||||
|
||||
if raise_on_http_errors and not (200 <= status < 300):
|
||||
raise ConnectionError('error in HTTP request to (status: %s)' % status)
|
||||
raise ConnectionError('error in HTTP request to %s (status: %s)' % (url, status))
|
||||
|
||||
return response, status, data, auth_header
|
||||
|
||||
|
|
Loading…
Reference in New Issue