From d54b46806ced796702da8b34e258c804f70a7f22 Mon Sep 17 00:00:00 2001 From: Chris Lowder Date: Mon, 16 Jan 2012 17:48:32 +0000 Subject: [PATCH] Catching more than we need to. --- lib/foreman/cli.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/foreman/cli.rb b/lib/foreman/cli.rb index 8fa0997..d94205b 100644 --- a/lib/foreman/cli.rb +++ b/lib/foreman/cli.rb @@ -46,14 +46,14 @@ class Foreman::CLI < Thor def export(format, location=nil) check_procfile! - classy_format = classify(format) - formatter = constantize("Foreman::Export::#{ classy_format }") + begin + classy_format = classify(format) + formatter = constantize("Foreman::Export::#{ classy_format }") + rescue NameError => ex + error "Unknown export format: #{format} (no class Foreman::Export::#{ classy_format })." + end formatter.new(engine, options).export(location) - - rescue NameError => ex - error "Unknown export format: #{format}." - raise ex rescue Foreman::Export::Exception => ex error ex.message end