-
Notifications
You must be signed in to change notification settings - Fork 4
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
handle doi requests for articles with incomplete metadata #13
Comments
It's actually missing metadata that leads to this error. This is not new behaviour on ShortCodes' part, but apparently the new API has less coverage in terms of dois, so I agree it's quite annoying. I originally figured there was no use in a fallback method for missing metadata, but willing to reconsider if there are good suggestions for what the fallback behavior should be. Just displaying the doi, perhaps? julia> using Revise, ShortCodes
julia> ShortCodes.fetch_citation_count("10.1103/PhysRev.65.117")
4661
julia> ShortCodes.fetch_metadata("10.1103/PhysRev.65.117")
ERROR: BoundsError: attempt to access 0-element JSON3.Array{Union{}, Vector{UInt8}, Vector{UInt64}} at index [1]
Stacktrace:
[1] throw_boundserror(A::JSON3.Array{Union{}, Vector{UInt8}, Vector{UInt64}}, I::Tuple{Int64})
@ Base ./abstractarray.jl:745
[2] checkbounds
@ ./abstractarray.jl:710 [inlined]
[3] getindex(arr::JSON3.Array{Union{}, Vector{UInt8}, Vector{UInt64}}, i::Int64)
@ JSON3 ~/.julia/packages/JSON3/CpNms/src/JSON3.jl:158
[4] var"##fetch_metadata_unmemoized"(doi::String)
@ ShortCodes ~/code/ShortCodes.jl/src/doi.jl:68
[5] #5
@ ~/.julia/packages/Memoize/12ANR/src/Memoize.jl:62 [inlined]
[6] get!
@ ./iddict.jl:178 [inlined]
[7] fetch_metadata(doi::String)
@ ShortCodes ~/.julia/packages/Memoize/12ANR/src/Memoize.jl:61
[8] top-level scope
@ REPL[4]:1
julia>
|
I agree, if missing metadata, a good fallback would be just to show the doi link. |
I'm happy to have a go at this if you can suggest the right place to set the fallback from the metadata error |
@AshtonSBradley I created a pull request (#14) that hopefully fixes this. I didn't touch the |
Fallback support for failed metadata retrieval (Fixes #13).
If I try something that is new or very old, I hit an error that I guess is needing to handle zero citation data as a special case?
The text was updated successfully, but these errors were encountered: