Skip to content

Commit b75ca73

Browse files
committed
Improve error handling in CDI file content download function
1 parent 37fa812 commit b75ca73

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

examples/cdi-exporter/transformer.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ def get_cdi_file_content(site_url, file_id):
2525
url = site_url + '/api/access/datafile/' + str(file_id)
2626
request = urllib2.Request(url)
2727
response = urllib2.urlopen(request, timeout=30)
28-
content = response.read()
29-
# Try to parse as JSON to validate
30-
parsed = json.loads(content)
31-
return parsed
32-
except:
28+
return response.read()
29+
except Exception as e:
30+
import sys
31+
sys.stderr.write('Error downloading CDI file: ' + str(e) + '\n')
3332
return None
3433

3534
# Try to find and return existing CDI file

0 commit comments

Comments
 (0)