From c874a734fd889aebda3c124bd4aa2a9dcce07b49 Mon Sep 17 00:00:00 2001 From: Eneko Lakasta Date: Mon, 2 Jul 2018 13:02:36 +0200 Subject: [PATCH] fix db limit error message set order --- lib/cartodb/api/middlewares/error-middleware.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cartodb/api/middlewares/error-middleware.js b/lib/cartodb/api/middlewares/error-middleware.js index 74a7c701..1c022dde 100644 --- a/lib/cartodb/api/middlewares/error-middleware.js +++ b/lib/cartodb/api/middlewares/error-middleware.js @@ -56,13 +56,15 @@ function populateTimeoutErrors (errors) { error.subtype = 'render'; } + 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'; error.type = 'limit'; error.http_status = 429; } - if (isDatasourceTimeoutError(error)) { + 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.';