Skip to content

Commit

Permalink
Merge pull request #81 from trayio/anastasiia-siniukova/CSP-6106/upda…
Browse files Browse the repository at this point in the history
…te-threadneedle-err-messages

[CSP-6106] /update-threadneedle-err-messages
  • Loading branch information
Asya authored Mar 29, 2021
2 parents bb6eca0 + 9ad4bdf commit 39e7b9d
Show file tree
Hide file tree
Showing 7 changed files with 222 additions and 215 deletions.
3 changes: 0 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ module.exports = function (grunt) {
// Configure a mochaTest task
mochaTest: {
test: {
options: {
reporter: 'mocha-unfunk-reporter'
},
src: ['tests/*_test.js']
}
},
Expand Down
8 changes: 4 additions & 4 deletions lib/addMethod/validateRESTInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ module.exports = function (methodName, config) {

// Ensure the minimum parameters have been passed
if (!methodName || !_.isString(methodName)) {
throw new Error('The first parameter passed to `addMethod` should be a string.');
throw new Error(`The first parameter passed to 'addMethod' should be a string. Method: ${methodName}`);
}
// If a function is inputted as the `config`, then just return - there's
// really not much to validate.
if (_.isFunction(config)) {
return;
}
if (!config || !_.isObject(config)) {
throw new Error('The `config` object should be an object.');
throw new Error(`The 'config' object should be an object. Method: ${methodName}`);
}

// Check to see if the method has already been declared
Expand All @@ -24,7 +24,7 @@ module.exports = function (methodName, config) {

// Ensure the config parameters have been specified correctly
if (!config.url && config.url !== '') {
throw new Error('The `url` config parameter should be declared.');
throw new Error(`The 'url' config parameter should be declared. Method: ${methodName}`);
}

let method = config.method;
Expand All @@ -38,7 +38,7 @@ module.exports = function (methodName, config) {
}
}
} else if (!_.isFunction(method)) {
throw new Error('The `method` parameter needs to be provided in the method configuration.');
throw new Error(`The 'method' parameter needs to be provided in the method configuration. Method: ${methodName}`);
}

};
6 changes: 3 additions & 3 deletions lib/addMethod/validateSOAPInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ module.exports = function (methodName, config) {

// Ensure the minimum parameters have been passed
if (!methodName || !_.isString(methodName)) {
throw new Error('The first parameter passed to `addMethod` should be a string.');
throw new Error(`The first parameter passed to 'addMethod' should be a string. Method: ${methodName}`);
}
// If a function is inputted as the `config`, then just return - there's
// really not much to validate.
if (_.isFunction(config)) {
return;
}
if (!config || !_.isObject(config)) {
throw new Error('The `config` object should be an object.');
throw new Error(`The 'config' object should be an object. Method: ${methodName}`);
}

// Check to see if the method has already been declared
Expand All @@ -22,7 +22,7 @@ module.exports = function (methodName, config) {

// Ensure the config parameters have been specified correctly
if (!config.method) {
throw new Error('The `method` config parameter should be declared.');
throw new Error(`The 'method' config parameter should be declared. Method: ${methodName}`);
}

if (!_.isUndefined(config.expects) && !_.isFunction(config.expects)) {
Expand Down
Loading

0 comments on commit 39e7b9d

Please sign in to comment.