Commit a7a4651f authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Controla errores de petición de schema fallida

Cuando el servidor responde con un error, pero sin un status http acorde
a ese error, se pisa con un status 500. Se podrá controlar desde el
servidor expressjs, pero por ahora queda parcheado así.

Cuando el módulo Model va a pedir el schema correspondiente a su target,
no lo hace si éste no tiene el prefijo de ruta de la api. Esto controla
peticiones de schema para rutas locales, que siempre van a acabar en
error, por ejemplo.
parent 1e95f625
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -108,7 +108,9 @@ run-remote-unit-tests-firefox:
    <<: *run-remote-test-variables
  script:
    - npm start &
    - grunt test-functional-remote --functionalSuites=tests/functional/modules/**/!\(*Script\).js --headless --browser=${TEST_BROWSER} --remoteHost=${TEST_REMOTE_HOST}
    - >
      grunt test-functional-remote --functionalSuites=tests/functional/modules/**/!\(*Script\).js --headless
      --browser=${TEST_BROWSER} --remoteHost=${TEST_REMOTE_HOST}

run-remote-modules-functional-tests-chrome:
  extends: .run-remote-modules-functional-tests
+0 −4
Original line number Diff line number Diff line
@@ -109,10 +109,6 @@ define([
				target: this.targetChange,
				refresh: true
			});
		},

		_itemAvailable: function(response) {

		}
	});
});
+9 −7
Original line number Diff line number Diff line
define([
	"dojo/_base/declare"
	, "dojo/_base/lang"
	, "redmic/modules/base/_Module"
	'app/redmicConfig'
	, 'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'redmic/modules/base/_Module'
	, 'redmic/modules/base/_Persistence'
	, "redmic/modules/base/_Store"
	, "./_ModelItfc"
	, 'redmic/modules/base/_Store'
	, './_ModelItfc'
], function(
	declare
	redmicConfig
	, declare
	, lang
	, _Module
	, _Persistence
@@ -191,7 +193,7 @@ define([

			if (this.schema) {
				this._buildModelWithSchema(this.schema);
			} else {
			} else if (this.target.indexOf(redmicConfig.apiUrlVariable) !== -1) {
				this._emitEvt("GET", {
					target: this.target,
					id: this.idForGet,
+8 −2
Original line number Diff line number Diff line
@@ -352,7 +352,13 @@ define([

		_parseError: function(res) {

			var response = res.response;
			var response = res.response,
				status = response.status;

			// TODO el server expressjs no debería responder con status bueno si le llega la petición a él, revisar
			if (status < 400) {
				status = 500;
			}

			// TODO usar response.data directamente cuando no se envuelva la respuesta con error
			var data = response.data;
@@ -361,7 +367,7 @@ define([
			}

			return {
				status: response.status,
				status: status,
				data: data,
				text: response.text,
				url: response.url,