Skip to content

Commit 6d8d5e4

Browse files
committed
copying bugfix from language translator to language translation
1 parent 0e4d658 commit 6d8d5e4

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

language-translation/v2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ LanguageTranslationV2.prototype.identify = function(params, callback) {
211211
defaultOptions: extend(true, {}, this._options, {
212212
headers: {
213213
'accept':'application/json',
214-
'content-type': 'plain/text'
214+
'content-type': 'text/plain'
215215
}
216216
})
217217
};

lib/requestwrapper.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ function formatErrorIfExists(cb) {
7070
});
7171
body.error = errObj.description;
7272
}
73-
error = new Error(body.error || 'Error Code: ' + body.error_code);
73+
// language translaton returns json with error_code and error_message
74+
error = new Error(body.error || body.error_message || 'Error Code: ' + body.error_code);
7475
error.code = body.error_code;
7576
Object.keys(body).forEach(function(key) {
7677
error[key] = body[key];

0 commit comments

Comments
 (0)