From 04cd9b23894f6353ee7d9730d48cd4e8d7fecb77 Mon Sep 17 00:00:00 2001 From: Juan Date: Wed, 4 Apr 2018 12:55:06 +0200 Subject: [PATCH] #223 - Global error handler refactor --- client/core/src/lib/interceptor.js | 6 ++++++ services/loopback/common/locale/en.json | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/client/core/src/lib/interceptor.js b/client/core/src/lib/interceptor.js index d6a2b4b59..5eac56e69 100644 --- a/client/core/src/lib/interceptor.js +++ b/client/core/src/lib/interceptor.js @@ -30,6 +30,12 @@ function interceptor($q, $window, vnApp, $translate, $cookies) { let data = rejection.data; let error; + switch (rejection.xhrStatus) { + case 'timeout': + case 'abort': + return $q.reject(rejection); + } + if (data && data.error instanceof Object) error = data.error.message; else if (rejection.status === -1) diff --git a/services/loopback/common/locale/en.json b/services/loopback/common/locale/en.json index cc493531c..cd258a4b6 100644 --- a/services/loopback/common/locale/en.json +++ b/services/loopback/common/locale/en.json @@ -8,5 +8,6 @@ "Ya existe un usuario con ese nombre": "Ya existe un usuario con ese nombre", "Quantity cannot be zero": "Quantity cannot be zero", "can't be blank": "can't be blank", - "DNI Incorrecto": "DNI Incorrecto" + "DNI Incorrecto": "DNI Incorrecto", + "El NIF/CIF debe ser Ășnico": "El NIF/CIF debe ser Ășnico" } \ No newline at end of file