[PATCH conductor 1/2] BZ821341: template_xml: show the same errors as CLI

Maros Zatko mzatko at redhat.com
Fri Aug 17 11:59:23 UTC 2012


On 08/16/2012 01:35 AM, Richard Su wrote:
> On 08/08/2012 08:03 AM, mzatko at redhat.com wrote:
>> From: Maros Zatko <mzatko at redhat.com>
>>
>> ---
>>   src/app/controllers/images_controller.rb |    8 ++++----
>>   src/app/models/template_xml.rb           |    4 ++--
>>   2 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/app/controllers/images_controller.rb 
>> b/src/app/controllers/images_controller.rb
>> index c3ca98c..af2bacc 100644
>> --- a/src/app/controllers/images_controller.rb
>> +++ b/src/app/controllers/images_controller.rb
>> @@ -234,8 +234,8 @@ class ImagesController < ApplicationController
>>         begin
>>         doc = TemplateXML.new(xml_source)
>> -    rescue Nokogiri::XML::SyntaxError
>> -      errors = [t('template_xml.errors.xml_parse_error')]
>> +    rescue Nokogiri::XML::SyntaxError => e
>> +      errors = [e.message]
>>       else
>>         doc.name = @name unless @name.blank?
>>         @name = doc.name
>> @@ -259,8 +259,8 @@ class ImagesController < ApplicationController
>>         begin
>>         doc = TemplateXML.new(@xml)
>> -    rescue Nokogiri::XML::SyntaxError
>> -      errors = [t('template_xml.errors.xml_parse_error')]
>> +    rescue Nokogiri::XML::SyntaxError => e
>> +      errors = [e.message]
>>       else
>>         @name = doc.name
>>         errors = doc.validate
>> diff --git a/src/app/models/template_xml.rb 
>> b/src/app/models/template_xml.rb
>> index 323b4e0..6462f36 100644
>> --- a/src/app/models/template_xml.rb
>> +++ b/src/app/models/template_xml.rb
>> @@ -38,8 +38,8 @@ class TemplateXML
>>     def self.validate(xmlstr)
>>       begin
>>         doc = TemplateXML.new(xmlstr)
>> -    rescue Nokogiri::XML::SyntaxError
>> -      return [I18n.t('template_xml.errors.xml_parse_error')]
>> +    rescue Nokogiri::XML::SyntaxError => e
>> +      return [e.message]
>>       end
>>       return doc.validate
>>     end
>
> Ack and pushed.
thank you



More information about the aeolus-devel mailing list