Author: ygrego Date: 2015-04-14 08:14:05 +0000 (Tue, 14 Apr 2015) New Revision: 1160 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1160 Log: The method "setQuery" verifies some criteria on its parameter. Modified: oipf/js/impl/model/MetadataSearch.js Modified: oipf/js/impl/model/MetadataSearch.js =================================================================== --- oipf/js/impl/model/MetadataSearch.js 2015-04-14 07:40:10 UTC (rev 1159) +++ oipf/js/impl/model/MetadataSearch.js 2015-04-14 08:14:05 UTC (rev 1160) @@ -202,7 +202,23 @@ * -query: The query terms to be used. * */ - setQuery: function(query){ + setQuery: function(query) { + var parameters = arguments; + + if (parameters.length > 1) { + throw new TypeError("Excessive number of arguments."); + } + + if (parameters.length < 1) { + throw new TypeError("Insufficient number of arguments."); + } + + if (!(query instanceof Query)) { + + throw new TypeError + ("This function cannot be called with this argument."); + + } this._currentQuery = query; },