Merge branch '984-sql-timeout-error-message' into 14075-2buckets-bubble-legends
This commit is contained in:
3
NEWS.md
3
NEWS.md
@@ -47,6 +47,9 @@ Bug Fixes:
|
||||
- Fix `meta.stats.estimatedFeatureCount` for aggregations and queries with tokens
|
||||
- Static maps filters correctly if `layer` option is passed in the url.
|
||||
|
||||
Announcements:
|
||||
* Improve error message when the DB query is over the user's limits
|
||||
|
||||
## 6.1.0
|
||||
Released 2018-04-16
|
||||
|
||||
|
||||
@@ -56,9 +56,7 @@ function populateTimeoutErrors (errors) {
|
||||
error.subtype = 'render';
|
||||
}
|
||||
|
||||
if (isDatasourceTimeoutError(error)) {
|
||||
error.subtype = 'datasource';
|
||||
}
|
||||
const IS_DATASOURCE_TIMEOUT_ERROR = isDatasourceTimeoutError(error);
|
||||
|
||||
if (isTimeoutError(error)) {
|
||||
error.message = 'You are over platform\'s limits. Please contact us to know more details';
|
||||
@@ -66,6 +64,12 @@ function populateTimeoutErrors (errors) {
|
||||
error.http_status = 429;
|
||||
}
|
||||
|
||||
if (IS_DATASOURCE_TIMEOUT_ERROR) {
|
||||
error.subtype = 'datasource';
|
||||
error.message = 'You are over platform\'s limits: SQL query timeout error.' +
|
||||
' Refactor your query before running again or contact CARTO support for more details.';
|
||||
}
|
||||
|
||||
return error;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -68,16 +68,19 @@ const createMapConfig = ({
|
||||
}
|
||||
});
|
||||
|
||||
const db_limit_error_message = 'You are over platform\'s limits: SQL query timeout error.' +
|
||||
' Refactor your query before running again or contact CARTO support for more details.';
|
||||
|
||||
const DATASOURCE_TIMEOUT_ERROR = {
|
||||
errors: ['You are over platform\'s limits. Please contact us to know more details'],
|
||||
errors: [db_limit_error_message],
|
||||
errors_with_context: [{
|
||||
type: 'limit',
|
||||
subtype: 'datasource',
|
||||
message: 'You are over platform\'s limits. Please contact us to know more details'
|
||||
message: db_limit_error_message
|
||||
}]
|
||||
};
|
||||
|
||||
describe('user database timeout limit', function () {
|
||||
describe.only('user database timeout limit', function () {
|
||||
describe('dataview', function () {
|
||||
beforeEach(function (done) {
|
||||
const mapconfig = createMapConfig();
|
||||
@@ -141,11 +144,11 @@ describe('user database timeout limit', function () {
|
||||
|
||||
this.testClient.getLayergroup({ response: expectedResponse }, (err, timeoutError) => {
|
||||
assert.deepEqual(timeoutError, {
|
||||
errors: [ 'You are over platform\'s limits. Please contact us to know more details' ],
|
||||
errors: [db_limit_error_message ],
|
||||
errors_with_context: [{
|
||||
type: 'limit',
|
||||
subtype: 'datasource',
|
||||
message: 'You are over platform\'s limits. Please contact us to know more details',
|
||||
message: db_limit_error_message,
|
||||
layer: { id: 'layer0', index: 0, type: 'mapnik' }
|
||||
}]
|
||||
});
|
||||
@@ -363,11 +366,11 @@ describe('user database timeout limit', function () {
|
||||
|
||||
this.testClient.getLayergroup({ response: expectedResponse }, (err, timeoutError) => {
|
||||
assert.deepEqual(timeoutError, {
|
||||
errors: [ 'You are over platform\'s limits. Please contact us to know more details' ],
|
||||
errors: [ db_limit_error_message ],
|
||||
errors_with_context: [{
|
||||
type: 'limit',
|
||||
subtype: 'datasource',
|
||||
message: 'You are over platform\'s limits. Please contact us to know more details',
|
||||
message: db_limit_error_message,
|
||||
layer: { id: 'layer0', index: 0, type: 'mapnik' }
|
||||
}]
|
||||
});
|
||||
@@ -541,11 +544,11 @@ describe('user database timeout limit', function () {
|
||||
|
||||
this.testClient.getLayergroup({ response: expectedResponse }, (err, timeoutError) => {
|
||||
assert.deepEqual(timeoutError, {
|
||||
errors: [ 'You are over platform\'s limits. Please contact us to know more details' ],
|
||||
errors: [ db_limit_error_message ],
|
||||
errors_with_context: [{
|
||||
type: 'limit',
|
||||
subtype: 'datasource',
|
||||
message: 'You are over platform\'s limits. Please contact us to know more details',
|
||||
message: db_limit_error_message,
|
||||
layer: { id: 'layer0', index: 0, type: 'mapnik' }
|
||||
}]
|
||||
});
|
||||
@@ -645,11 +648,11 @@ describe('user database timeout limit', function () {
|
||||
|
||||
this.testClient.getLayergroup({ response: expectedResponse }, (err, timeoutError) => {
|
||||
assert.deepEqual(timeoutError, {
|
||||
errors: [ 'You are over platform\'s limits. Please contact us to know more details' ],
|
||||
errors: [db_limit_error_message],
|
||||
errors_with_context: [{
|
||||
type: 'limit',
|
||||
subtype: 'datasource',
|
||||
message: 'You are over platform\'s limits. Please contact us to know more details',
|
||||
message: db_limit_error_message,
|
||||
layer: { id: 'torque-layer0', index: 0, type: 'torque' }
|
||||
}]
|
||||
});
|
||||
@@ -776,11 +779,11 @@ describe('user database timeout limit', function () {
|
||||
|
||||
this.testClient.getLayergroup({ response: expectedResponse }, (err, timeoutError) => {
|
||||
assert.deepEqual(timeoutError, {
|
||||
errors: [ 'You are over platform\'s limits. Please contact us to know more details' ],
|
||||
errors: [db_limit_error_message],
|
||||
errors_with_context: [{
|
||||
type: 'limit',
|
||||
subtype: 'datasource',
|
||||
message: 'You are over platform\'s limits. Please contact us to know more details',
|
||||
message: db_limit_error_message,
|
||||
layer: {
|
||||
id: 'layer0',
|
||||
index: 0,
|
||||
|
||||
Reference in New Issue
Block a user