Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getauthorshortid() breaks if error found #2

Open
chrMongeau opened this issue Jul 20, 2020 · 0 comments
Open

getauthorshortid() breaks if error found #2

chrMongeau opened this issue Jul 20, 2020 · 0 comments

Comments

@chrMongeau
Copy link
Owner

If the API call returns an error, the following breaks ungraciously:

res <- jsonlite::fromJSON(f)
cols_ord <- c('shortid', 'name', 'last', 'first',
'middle', 'suffix', 'repecurl')
return(res[cols_ord])

Should add error checking as in:

if ('error' %in% names(res)) {
stop('RePEc API returned an error. Are you using a valid `code`?')
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant