X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/25d0017b18773458529275d2f60f2599ee03a633..cd8bb0dc577f2384a7b9732fb9ac9ec390fc8b19:/app/controllers/application_controller.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0d6cdea64..3eefa4a91 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -101,9 +101,12 @@ class ApplicationController < ActionController::Base end def set_locale + response.header['Vary'] = 'Accept-Language' + if @user if !@user.languages.empty? request.user_preferred_languages = @user.languages + response.header['Vary'] = '*' elsif !request.user_preferred_languages.empty? @user.languages = request.user_preferred_languages @user.save @@ -129,6 +132,8 @@ class ApplicationController < ActionController::Base rescue OSM::APIError => ex report_error ex.message, ex.status rescue Exception => ex + logger.info("API threw unexpected #{ex.class} exception: #{ex.message}") + ex.backtrace.each { |l| logger.info(l) } report_error "#{ex.class}: #{ex.message}", :internal_server_error end end