Ruby on rails 如何在ruby on rails中处理rescue_responses配置中的I18n::InvalidLocale

Ruby on rails 如何在ruby on rails中处理rescue_responses配置中的I18n::InvalidLocale,ruby-on-rails,exception,exception-handling,locale,rails-i18n,Ruby On Rails,Exception,Exception Handling,Locale,Rails I18n,我正在开发rails应用程序。通过在application.rb中添加这些配置,尝试使用Rack的本机方式处理所有自定义和本机异常 config.exceptions_app = self.routes config.action_dispatch.rescue_responses.merge!('Exceptions::RecordNotFoundError' => :not_found, 'ActionController::RoutingError' => :not_found

我正在开发rails应用程序。通过在application.rb中添加这些配置,尝试使用Rack的本机方式处理所有自定义和本机异常

config.exceptions_app = self.routes
config.action_dispatch.rescue_responses.merge!('Exceptions::RecordNotFoundError' => :not_found, 'ActionController::RoutingError' => :not_found, 'I18n::InvalidLocale' => :not_found)
注意:
异常::RecordNotFoundError
是一个自定义异常

我的网站未捕获
I18n::InvalidLocale
异常。我做错什么了吗。我不想在我的应用程序控制器中添加rescue语句来处理此异常