More clear turbo-carto error messages: no context in message
This commit is contained in:
parent
f55b748d20
commit
80d5b29902
1
NEWS.md
1
NEWS.md
@ -5,6 +5,7 @@
|
||||
Released 2016-mm-dd
|
||||
|
||||
Enhancements:
|
||||
- More clear turbo-carto error messages: no context in message.
|
||||
- Return multiple turbo-carto errors #541.
|
||||
|
||||
Announcements:
|
||||
|
@ -87,7 +87,7 @@ TurboCartoAdapter.prototype._parseCartoCss = function (username, params, layer,
|
||||
function processCallback(err, cartocss) {
|
||||
// Only return turbo-carto errors
|
||||
if (err && err.name === 'TurboCartoError') {
|
||||
var error = new Error('turbo-carto: ' + err.message);
|
||||
var error = new Error(err.message);
|
||||
error.http_status = 400;
|
||||
error.type = 'layer';
|
||||
error.subtype = 'turbo-carto';
|
||||
@ -115,9 +115,7 @@ TurboCartoAdapter.prototype._parseCartoCss = function (username, params, layer,
|
||||
var tokensQuery = tokensQueryTpl({_sql: layerRawSql});
|
||||
return pg.query(tokensQuery, function(err, resultSet) {
|
||||
if (err) {
|
||||
var error = new Error('turbo-carto: ' + err.message);
|
||||
error.type = 'turbo-carto';
|
||||
return processCallback(error);
|
||||
return processCallback(err);
|
||||
}
|
||||
|
||||
resultSet = resultSet || {};
|
||||
|
@ -56,7 +56,7 @@ describe('turbo-carto error cases', function() {
|
||||
|
||||
assert.ok(layergroup.hasOwnProperty('errors'));
|
||||
assert.equal(layergroup.errors.length, 1);
|
||||
assert.ok(layergroup.errors[0].match(/^turbo-carto/));
|
||||
assert.ok(layergroup.errors[0].match(/^Failed\sto\sprocess/));
|
||||
assert.ok(layergroup.errors[0].match(/invalid\sramp\slength/i));
|
||||
|
||||
done();
|
||||
@ -70,7 +70,7 @@ describe('turbo-carto error cases', function() {
|
||||
|
||||
assert.ok(layergroup.hasOwnProperty('errors'));
|
||||
assert.equal(layergroup.errors.length, 1);
|
||||
assert.ok(layergroup.errors[0].match(/^turbo-carto/));
|
||||
assert.ok(layergroup.errors[0].match(/^Failed\sto\sprocess/));
|
||||
assert.ok(layergroup.errors[0].match(/unable\sto\scompute\sramp/i));
|
||||
assert.ok(layergroup.errors[0].match(/wadus_column/));
|
||||
|
||||
@ -85,7 +85,7 @@ describe('turbo-carto error cases', function() {
|
||||
|
||||
assert.ok(layergroup.hasOwnProperty('errors'));
|
||||
assert.equal(layergroup.errors.length, 1);
|
||||
assert.ok(layergroup.errors[0].match(/^turbo-carto/));
|
||||
assert.ok(layergroup.errors[0].match(/^Failed\sto\sprocess/));
|
||||
assert.ok(layergroup.errors[0].match(/unable\sto\scompute\sramp/i));
|
||||
assert.ok(layergroup.errors[0].match(/invalid\smethod\s\"wadusmethod\"/i));
|
||||
|
||||
@ -100,7 +100,7 @@ describe('turbo-carto error cases', function() {
|
||||
|
||||
assert.ok(layergroup.hasOwnProperty('errors'));
|
||||
assert.equal(layergroup.errors.length, 1);
|
||||
assert.ok(!layergroup.errors[0].match(/^turbo-carto/));
|
||||
assert.ok(!layergroup.errors[0].match(/^Failed\sto\sprocess/));
|
||||
assert.ok(layergroup.errors[0].match(/invalid\scode/i));
|
||||
|
||||
done();
|
||||
@ -116,7 +116,7 @@ describe('turbo-carto error cases', function() {
|
||||
assert.equal(layergroup.errors_with_context.length, 1);
|
||||
assert.equal(layergroup.errors_with_context[0].type, 'layer');
|
||||
assert.equal(layergroup.errors_with_context[0].subtype, 'turbo-carto');
|
||||
assert.ok(layergroup.errors_with_context[0].message.match(/^turbo-carto/));
|
||||
assert.ok(layergroup.errors_with_context[0].message.match(/^Failed\sto\sprocess/));
|
||||
assert.ok(layergroup.errors_with_context[0].message.match(/unable\sto\scompute\sramp/i));
|
||||
assert.ok(layergroup.errors_with_context[0].message.match(/wadus_column/));
|
||||
|
||||
@ -172,14 +172,14 @@ describe('turbo-carto error cases', function() {
|
||||
|
||||
assert.equal(layergroup.errors_with_context[0].type, 'layer');
|
||||
assert.equal(layergroup.errors_with_context[0].subtype, 'turbo-carto');
|
||||
assert.ok(layergroup.errors_with_context[0].message.match(/^turbo-carto/));
|
||||
assert.ok(layergroup.errors_with_context[0].message.match(/^Failed\sto\sprocess/));
|
||||
assert.ok(layergroup.errors_with_context[0].message.match(/unable\sto\scompute\sramp/i));
|
||||
assert.ok(layergroup.errors_with_context[0].message.match(/wadus_column/));
|
||||
assert.equal(layergroup.errors_with_context[0].layer.id, 'layer0');
|
||||
|
||||
assert.equal(layergroup.errors_with_context[1].type, 'layer');
|
||||
assert.equal(layergroup.errors_with_context[1].subtype, 'turbo-carto');
|
||||
assert.ok(layergroup.errors_with_context[1].message.match(/^turbo-carto/));
|
||||
assert.ok(layergroup.errors_with_context[1].message.match(/^Failed\sto\sprocess/));
|
||||
assert.ok(layergroup.errors_with_context[1].message.match(/unable\sto\scompute\sramp/i));
|
||||
assert.ok(layergroup.errors_with_context[1].message.match(/invalid_column/));
|
||||
assert.equal(layergroup.errors_with_context[1].layer.id, 'layer1');
|
||||
|
Loading…
Reference in New Issue
Block a user