Commit 3c4f9683 authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Sebastien Robin

Fix bug: error message when parameter is undefined.

parent 27646bab
...@@ -925,6 +925,17 @@ var JIO = ...@@ -925,6 +925,17 @@ var JIO =
var that = {}, priv = {}; var that = {}, priv = {};
priv.wrongParametersError = function (settings) {
var m = 'Method: '+ settings.method +
', One or some parameters are undefined.';
console.error (m);
settings.callback({status:'fail',
error: {status:0,
statusText:'Undefined Parameter',
message: m}});
return null;
};
//// Getters Setters //// Getters Setters
that.getID = function () { that.getID = function () {
return priv.id; return priv.id;
...@@ -1036,7 +1047,7 @@ var JIO = ...@@ -1036,7 +1047,7 @@ var JIO =
settings.storage && settings.applicant) { settings.storage && settings.applicant) {
return priv.queue.createJob ( settings ); return priv.queue.createJob ( settings );
} }
return null; return priv.wrongParametersError(settings);
}; };
that.saveDocument = function ( options ) { that.saveDocument = function ( options ) {
...@@ -1068,7 +1079,7 @@ var JIO = ...@@ -1068,7 +1079,7 @@ var JIO =
settings.storage && settings.applicant) { settings.storage && settings.applicant) {
return priv.queue.createJob ( settings ); return priv.queue.createJob ( settings );
} }
return null; return priv.wrongParametersError(settings);
}; };
that.loadDocument = function ( options ) { that.loadDocument = function ( options ) {
...@@ -1105,7 +1116,7 @@ var JIO = ...@@ -1105,7 +1116,7 @@ var JIO =
settings.storage && settings.applicant) { settings.storage && settings.applicant) {
return priv.queue.createJob ( settings ); return priv.queue.createJob ( settings );
} }
return null; return priv.wrongParametersError(settings);
}; };
that.getDocumentList = function ( options ) { that.getDocumentList = function ( options ) {
...@@ -1138,7 +1149,7 @@ var JIO = ...@@ -1138,7 +1149,7 @@ var JIO =
if (that.isReady() && settings.storage && settings.applicant ) { if (that.isReady() && settings.storage && settings.applicant ) {
return priv.queue.createJob( settings ); return priv.queue.createJob( settings );
} }
return null; return priv.wrongParametersError(settings);
}; };
that.removeDocument = function ( options ) { that.removeDocument = function ( options ) {
...@@ -1168,7 +1179,7 @@ var JIO = ...@@ -1168,7 +1179,7 @@ var JIO =
settings.storage && settings.applicant ) { settings.storage && settings.applicant ) {
return priv.queue.createJob ( settings ); return priv.queue.createJob ( settings );
} }
return null; return priv.wrongParametersError(settings);
}; };
//// end Methods //// end Methods
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment