Skip to content

Commit

Permalink
[fix] small fix for graceful error handling of invalid DOI/ID
Browse files Browse the repository at this point in the history
  • Loading branch information
dvolgyes committed Jun 8, 2018
1 parent 8f2fab5 commit 31d5cdd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
zenodo_get: a downloader for Zenodo records
===========================================
Travis CI:[![Build Status](https://travis-ci.org/dvolgyes/zenodo_get.svg?branch=master)](https://travis-ci.org/dvolgyes/zenodo_get)
Travis:[![Build Status](https://travis-ci.org/dvolgyes/zenodo_get.svg?branch=master)](https://travis-ci.org/dvolgyes/zenodo_get)
Semaphore:[![Build Status](https://semaphoreci.com/api/v1/dvolgyes/zenodo_get/branches/master/badge.svg)](https://semaphoreci.com/dvolgyes/zenodo_get)
CircleCI:[![Build status](https://circleci.com/gh/dvolgyes/zenodo_get.svg?style=svg)](https://circleci.com/gh/dvolgyes/zenodo_get)
AppVeyor:[![Build status](https://ci.appveyor.com/api/projects/status/f6hw96rhdl104ch9?svg=true)](https://ci.appveyor.com/project/dvolgyes/zenodo-get)
Gitlab CI:[![gitlabci](https://gitlab.com/dvolgyes/zenodo_get/badges/master/build.svg)](https://gitlab.com/dvolgyes/zenodo_get/pipelines)
GitlabCI:[![gitlabci](https://gitlab.com/dvolgyes/zenodo_get/badges/master/build.svg)](https://gitlab.com/dvolgyes/zenodo_get/pipelines)

Coveralls:[![Coverage Status](https://coveralls.io/repos/github/dvolgyes/zenodo_get/badge.svg?branch=master)](https://coveralls.io/github/dvolgyes/zenodo_get?branch=master)
Codecov:[![codecov](https://codecov.io/gh/dvolgyes/zenodo_get/branch/master/graph/badge.svg)](https://codecov.io/gh/dvolgyes/zenodo_get)
Expand Down
6 changes: 5 additions & 1 deletion src/zenodo_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ def check_hash(filename, checksum):
url = options.doi
if not url.startswith('http'):
url = 'https://doi.org/'+url
r = requests.get(url)
try:
r = requests.get(url)
except:
eprint('Connection error. Please, check the DOI/ID, and try again later.')
sys.exit(1)
if not r.ok:
eprint('DOI could not be resolved. Try again, or use record ID.')
sys.exit(1)
Expand Down

0 comments on commit 31d5cdd

Please sign in to comment.