CDB-4157 proper error flow for seg faults due to unkown yet geojson, and for csvs with >1600 columns

pull/799/head
Kartones 10 years ago
parent da04935467
commit 3bf5bac755

@ -47,14 +47,21 @@ module CartoDB
job.log "ogr2ogr output: #{ogr2ogr.command_output}"
job.log "ogr2ogr exit code: #{ogr2ogr.exit_code}"
raise InvalidGeoJSONError if ogr2ogr.command_output =~ /nrecognized GeoJSON/
raise InvalidGeoJSONError.new(job.logger) if ogr2ogr.command_output =~ /nrecognized GeoJSON/
raise MalformedCSVException.new(job.logger) if ogr2ogr.command_output =~ /tables can have at most 1600 columns/
if ogr2ogr.exit_code != 0
if (ogr2ogr.exit_code == 256 && ogr2ogr.command_output =~ /calloc failed/) || \
(ogr2ogr.exit_code == 35584 && ogr2ogr.command_output =~ /Segmentation fault/)
# OOM
if ogr2ogr.exit_code == 256 && ogr2ogr.command_output =~ /calloc failed/
raise FileTooBigError.new(job.logger)
end
# Could be OOM, could be wrong input
if ogr2ogr.exit_code == 35584 && ogr2ogr.command_output =~ /Segmentation fault/
raise LoadError.new(job.logger)
end
if ogr2ogr.exit_code == 256 && ogr2ogr.command_output =~ /Unable to open(.*)with the following drivers/
raise UnsupportedFormatError.new
raise UnsupportedFormatError.new(job.logger)
end
raise LoadError.new(job.logger)
end

Loading…
Cancel
Save