diff --git a/app/controllers/copy_controller.js b/app/controllers/copy_controller.js index 9aabbf00..a3547019 100644 --- a/app/controllers/copy_controller.js +++ b/app/controllers/copy_controller.js @@ -126,6 +126,7 @@ function handleCopyFrom (logger) { }) .pipe(isGzip ? zlib.createGunzip() : new PassThrough()) .on('error', err => { + err.message = `Error while gunzipping: ${err.message}` metrics.end(null, err); pgstream.emit('error', err); }) diff --git a/test/acceptance/copy-endpoints.js b/test/acceptance/copy-endpoints.js index 4aa63cbb..22c0d158 100644 --- a/test/acceptance/copy-endpoints.js +++ b/test/acceptance/copy-endpoints.js @@ -187,7 +187,7 @@ describe('copy-endpoints', function() { }); }); - it('should return an error when gzip headers are not correct', function(done) { + it.only('should return an error when gzip headers are not correct', function(done) { assert.response(server, { url: "/api/v1/sql/copyfrom?" + querystring.stringify({ q: "COPY copy_endpoints_test (id, name) FROM STDIN WITH (FORMAT CSV, DELIMITER ',', HEADER true)" @@ -203,7 +203,7 @@ describe('copy-endpoints', function() { assert.deepEqual( JSON.parse(res.body), { - error:["incorrect header check"] + error:["Error while gunzipping: incorrect header check"] } ); done();