Fixes #143 by checking for empty response

Also try/catch JSON.parse for an error.