watson-developer-cloud
Advanced tools
Comparing version 2.6.1 to 2.6.2
@@ -23,20 +23,4 @@ /** | ||
var BaseServiceAlchemy = require('../lib/base_service_alchemy'); | ||
var errorFormatter = require('../lib/alchemy_error_formatter'); | ||
function errorFormatter(cb) { | ||
return function(err, result, response) { | ||
if (err) { | ||
cb(err, result); | ||
} | ||
else { | ||
if (result.status === 'OK') | ||
cb(err,result); | ||
else | ||
cb({ | ||
error: result.statusInfo || response['headers']['x-alchemyapi-error-msg'], | ||
code: 400 | ||
}, null); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -63,3 +47,3 @@ * @param options | ||
*/ | ||
AlchemyDataNewsV1.prototype.getNews = function(params, callback ) { | ||
AlchemyDataNewsV1.prototype.getNews = function (params, callback ) { | ||
params = params || {}; | ||
@@ -66,0 +50,0 @@ |
@@ -30,18 +30,3 @@ /** | ||
var pick = require('object.pick'); | ||
function errorFormatter(cb) { | ||
return function(err, result, response) { | ||
if (err) { | ||
cb(err, result); | ||
} | ||
else { | ||
if (result.status === 'OK') | ||
cb(err,result); | ||
else | ||
cb({ | ||
error: result.statusInfo || response['headers']['x-alchemyapi-error-msg'], | ||
code: 400 | ||
}, null); | ||
} | ||
}; | ||
} | ||
var errorFormatter = require('../lib/alchemy_error_formatter'); | ||
@@ -48,0 +33,0 @@ function createRequest(method) { |
@@ -27,20 +27,4 @@ /** | ||
var BaseServiceAlchemy = require('../lib/base_service_alchemy'); | ||
var errorFormatter = require('../lib/alchemy_error_formatter'); | ||
function errorFormatter(cb) { | ||
return function(err, result, response) { | ||
if (err) { | ||
cb(err, result); | ||
} | ||
else { | ||
if (result.status === 'OK') | ||
cb(err,result); | ||
else | ||
cb({ | ||
error: result.statusInfo || response['headers']['x-alchemyapi-error-msg'], | ||
code: 400 | ||
}, null); | ||
} | ||
}; | ||
} | ||
function createRequest(method) { | ||
@@ -47,0 +31,0 @@ return function(_params, callback ) { |
@@ -0,1 +1,5 @@ | ||
# v2.6.1 | ||
* Ensure errors are always instanceof Error | ||
* Doc improvements | ||
# v2.6.0 | ||
@@ -2,0 +6,0 @@ * Added support for Personality Insights V3 |
@@ -45,6 +45,12 @@ /** | ||
function formatErrorIfExists(cb) { | ||
return function(error, response, body) { | ||
return function(error, response, body) { // eslint-disable-line complexity | ||
// If we have an error return it. | ||
if (error) { | ||
// first ensure that it's an instanceof Error | ||
if ( !error instanceof Error) { | ||
body = error; | ||
error = new Error(error.message || error.error || error); | ||
error.body = body; | ||
} | ||
cb(error, body, response); | ||
@@ -51,0 +57,0 @@ return; |
{ | ||
"name": "watson-developer-cloud", | ||
"version": "2.6.1", | ||
"version": "2.6.2", | ||
"description": "Client library to use the IBM Watson Services and AlchemyAPI", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index", |
@@ -1030,3 +1030,3 @@ /** | ||
* @param {Object} params | ||
* @param {String} params.classifier_id The classifier id | ||
* @param {String} params.collection_id The collection id | ||
* @param {ReadableStream} params.image_file The image file (.jpg or .png) of the image to search against the collection. | ||
@@ -1033,0 +1033,0 @@ * @param {Number} [params.limit=10] limit The number of similar results you want returned. Default limit is 10 results, you can specify a maximum limit of 100 results. |
Sorry, the diff of this file is not supported yet
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
41
0
100
230013
5398