diff --git a/lib/address.js b/lib/address.js index be9fc8a..5273fa1 100644 --- a/lib/address.js +++ b/lib/address.js @@ -58,7 +58,7 @@ function Address(data, network, type) { return data; } - $.checkArgument(data, new TypeError('First argument is required, please include address data.')); + $.checkArgument(data, 'First argument is required, please include address data.', 'guide/address.html'); if (network && !Networks.get(network)) { throw new TypeError('Second argument must be "livenet" or "testnet".'); diff --git a/lib/errors/spec.js b/lib/errors/spec.js index 5784b08..c2dd28a 100644 --- a/lib/errors/spec.js +++ b/lib/errors/spec.js @@ -1,5 +1,7 @@ 'use strict'; +var docsURL = 'http://bitcore.io/'; + module.exports = [{ name: 'InvalidB58Char', message: 'Invalid Base58 character: {0} in {1}' @@ -21,7 +23,8 @@ module.exports = [{ }, { name: 'InvalidArgument', message: function() { - return 'Invalid Argument' + (arguments[0] ? (': ' + arguments[0]) : ''); + return 'Invalid Argument' + (arguments[0] ? (': ' + arguments[0]) : '') + + (arguments[1] ? (' Documentation: ' + docsURL + arguments[1]): ''); } }, { name: 'AbstractMethodInvoked', diff --git a/lib/util/preconditions.js b/lib/util/preconditions.js index 1b80eee..25a33b0 100644 --- a/lib/util/preconditions.js +++ b/lib/util/preconditions.js @@ -9,9 +9,9 @@ module.exports = { throw new errors.InvalidState(message); } }, - checkArgument: function(condition, argumentName, message) { + checkArgument: function(condition, argumentName, message, docsPath) { if (!condition) { - throw new errors.InvalidArgument(argumentName, message); + throw new errors.InvalidArgument(argumentName, message, docsPath); } }, checkArgumentType: function(argument, type, argumentName) {