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

Jan Provaznik jprovazn at redhat.com
Mon Aug 20 13:37:10 UTC 2012


On 08/08/2012 05:03 PM, 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
>

shouldn't be 'template_xml.errors.xml_parse_error' string removed from 
config/locale/en.yml since it's not used any more?



More information about the aeolus-devel mailing list