please extract it to a seperate method, and the rescue should be on the 
```ruby
private

def some_fancy_name
  if WHITELIST_OF_HOST_TYPES.include?(params[:type])
    params[:type].constantize
  else
    raise "invalid"
  end
rescue => e
  logger.warn "oops"
end
```