diff --git a/lib/synvert/command.rb b/lib/synvert/command.rb index fa9e8b8..d0f760b 100644 --- a/lib/synvert/command.rb +++ b/lib/synvert/command.rb @@ -179,10 +179,10 @@ def run_snippet(rewriter, format) if ENV['DEBUG'] puts e.backtrace.join("\n") end - if plain_output? - puts "Error: #{e.message}" - else + if format == 'json' puts({ error: e.message }.to_json) + else + puts "Error: #{e.message}" end raise end