From 2b22ba18f082cbd00f3feccb9e65d1a91f4d1a95 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Fri, 16 Jan 2015 16:51:15 +0200 Subject: [PATCH] Add fallback route --- app/controllers/epp/errors_controller.rb | 5 +++++ config/locales/en.yml | 1 + config/routes.rb | 2 ++ 3 files changed, 8 insertions(+) diff --git a/app/controllers/epp/errors_controller.rb b/app/controllers/epp/errors_controller.rb index b0da5473c..43b8ee6b1 100644 --- a/app/controllers/epp/errors_controller.rb +++ b/app/controllers/epp/errors_controller.rb @@ -3,4 +3,9 @@ class Epp::ErrorsController < EppController epp_errors << { code: params[:code], msg: params[:msg] } render_epp_response '/epp/error' end + + def not_found + epp_errors << { code: 2400, msg: t('could_not_determine_object_type_check_xml_format_and_namespaces') } + render_epp_response '/epp/error' + end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 5e17ae60c..3ad01a110 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -496,3 +496,4 @@ en: request_params: 'Request params' repp_log: 'REPP log' repp_logs: 'REPP logs' + could_not_determine_object_type_check_xml_format_and_namespaces: 'Could not determine object type. Check XML format and namespaces.' diff --git a/config/routes.rb b/config/routes.rb index 58f4c2020..74eb1ba9a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -32,6 +32,8 @@ Rails.application.routes.draw do post 'command/poll', to: 'polls#poll', constraints: EppConstraint.new(:poll) post 'command/keyrelay', to: 'keyrelays#keyrelay', constraints: EppConstraint.new(:keyrelay) + post 'command/:command', to: 'errors#not_found' # fallback route + get 'error/:command', to: 'errors#error' end