Skip to content

Commit

Permalink
wrap mdtranslator in try/except; derive new relic license key from env
Browse files Browse the repository at this point in the history
  • Loading branch information
rshewitt committed Jan 2, 2025
1 parent 79e9e41 commit 411af35
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions app/controllers/translates_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@ def create
reader_name = params[:reader]
writer_name = params[:writer]

@md_return =
ADIWG::Mdtranslator.translate(
file: file_obj,
reader: reader_name,
writer: writer_name
)

logger = Logger.new($stdout)

begin
@md_return =
ADIWG::Mdtranslator.translate(
file: file_obj,
reader: reader_name,
writer: writer_name
)
rescue StandardError => e
logger.error(e.message)
render json: {}, status: :internal_server_error
end

@md_return[:readerStructureMessages].each do |m|
logger.warn(m) if m.include? 'WARNING'
logger.info(m) if m.include? 'INFO'
Expand Down
2 changes: 1 addition & 1 deletion config/newrelic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

common: &default_settings
# Required license key associated with your New Relic account.
license_key: ""
license_key: <%= ENV['NEW_RELIC_LICENSE_KEY'] %>

# Your application name. Renaming here affects where data displays in New
# Relic. For more details, see https://docs.newrelic.com/docs/apm/new-relic-apm/maintenance/renaming-applications
Expand Down

0 comments on commit 411af35

Please sign in to comment.