Skip to content

Commit

Permalink
log errors #590
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jul 24, 2020
1 parent b7ea3a7 commit 5e43a10
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/graphql/types/doi_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ def formatted_citation(style: nil, locale: nil)
url = "https://doi.org/#{object.doi}"
end
bibliography.first.gsub(url, doi_link(url))
rescue CSL::ParseError => e
"Error: #{e.message}"
end

def references(**args)
Expand Down
3 changes: 3 additions & 0 deletions config/initializers/mime_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
o.locale = options[:locale] || "en-US"
o.citation
end.join("\n\n")
rescue TypeError => e
Rails.logger.error e.message
Rails.logger.error obj.inspect
rescue CSL::ParseError # unknown style and/or location
Array.wrap(obj).map do |o|
o.style = "apa"
Expand Down

0 comments on commit 5e43a10

Please sign in to comment.