mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 08:22:05 +02:00
Support multiple errors
This commit is contained in:
parent
1e2dad06f9
commit
9fdf40cdcd
6 changed files with 32 additions and 27 deletions
|
@ -12,6 +12,7 @@ module Epp::Common
|
|||
end
|
||||
|
||||
def proxy
|
||||
@errors = []
|
||||
@svTRID = "ccReg-#{'%010d' % rand(10 ** 10)}"
|
||||
send(params[:command])
|
||||
end
|
||||
|
@ -34,10 +35,10 @@ module Epp::Common
|
|||
|
||||
xsd = Nokogiri::XML::Schema(File.read("doc/schemas/#{type}-1.0.xsd"))
|
||||
doc = Nokogiri::XML(params[:frame])
|
||||
@extValues = xsd.validate(doc)
|
||||
if @extValues.any?
|
||||
@code = '2001'
|
||||
@msg = 'Command syntax error'
|
||||
ext_values = xsd.validate(doc)
|
||||
@errors = []
|
||||
if ext_values.any?
|
||||
@errors << {code: '2001', msg: 'Command syntax error', ext_values: ext_values}
|
||||
render '/epp/error' and return
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,8 @@ class Epp::ErrorsController < ApplicationController
|
|||
include Epp::Common
|
||||
|
||||
def error
|
||||
@code, @msg = params[:code], params[:msg]
|
||||
@errors = []
|
||||
@errors << {code: params[:code], msg: params[:msg]}
|
||||
render '/epp/error'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue