added error handling for invalid doi

I have checked in all the changes I made. Pls merge it to the master branch.