lib/uffizzi/services/compose_file_service.rb in uffizzi-cli-1.0.5 vs lib/uffizzi/services/compose_file_service.rb in uffizzi-cli-2.0.27

- old
+ new

@@ -82,11 +82,11 @@ Minitar.pack(path, Zlib::GzipWriter.new(File.open(tmp_tar_path, 'wb'))) gzipped_file_size = Pathname.new(tmp_tar_path).size if gzipped_file_size > MAX_HOST_VOLUME_GZIP_FILE_SIZE - Uffizzi.ui.say("File/Directory too big by path: #{path}. Gzipped tar archive size is #{gzipped_file_size}") + raise Uffizzi::Error.new("File or directory is too large:: #{path}. Gzipped tar archive size is #{gzipped_file_size}") end Base64.encode64(File.binread(tmp_tar_path)) end @@ -137,14 +137,15 @@ end def parse_compose_content_to_object(compose_content) begin compose_data = Psych.safe_load(compose_content, aliases: true) - rescue Psych::SyntaxError - Uffizzi.ui.say('Invalid compose file') + rescue Psych::SyntaxError => e + err = [e.problem, e.context].compact.join(' ') + raise Uffizzi::Error.new("Syntax error: #{err} at line #{e.line} column #{e.column}") end - Uffizzi.ui.say('Unsupported compose file') if compose_data.nil? + raise Uffizzi::Error.new('Unsupported compose file') if compose_data.nil? compose_data end def prepare_host_volumes_paths(services)