From 5bcfdc853b2ff5a2390da3de30b006f85f5c837c Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sat, 10 Jun 2017 20:42:29 +0000 Subject: Release of version 1.1.2. --- CHANGELOG.md | 7 ++++++- docs/global.html | 16 ++++++++-------- docs/index.html | 2 +- docs/index.js.html | 12 +++++++++--- package.json | 2 +- src/index.js | 10 ++++++++-- 6 files changed, 33 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 431fca1..39aa448 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,13 @@ # Description of releases +## 1.1.2 (11-06-2017) + +Fix: + - Processing of errors in the request is added. + ## 1.1.1 (05-06-2017) Features: -- A link to an example of using the library is added to the description. + - A link to an example of using the library is added to the description. ## 1.1.0 (04-06-2017) diff --git a/docs/global.html b/docs/global.html index a04aacb..4a70079 100644 --- a/docs/global.html +++ b/docs/global.html @@ -395,7 +395,7 @@
Source:
@@ -632,7 +632,7 @@
Source:
@@ -792,7 +792,7 @@
Source:
@@ -952,7 +952,7 @@
Source:
@@ -1112,7 +1112,7 @@
Source:
@@ -1268,7 +1268,7 @@
Source:
@@ -1428,7 +1428,7 @@
Source:
@@ -1635,7 +1635,7 @@
diff --git a/docs/index.html b/docs/index.html index 8333d77..1e6b066 100644 --- a/docs/index.html +++ b/docs/index.html @@ -57,7 +57,7 @@
diff --git a/docs/index.js.html b/docs/index.js.html index 1916ba5..467ffac 100644 --- a/docs/index.js.html +++ b/docs/index.js.html @@ -69,7 +69,10 @@ function connect(uuid, callback) { const request = http.request(query, function(response) { var json = ''; response.on('data', (raw) => json = decryptJSON(raw)); - response.on('end', () => callback(json.result)); + response.on('end', () => { + if (json.error) throw new Error(json.error.message); + callback(json.result); + }); }); request.on('error', (error) => Error(error.message)); @@ -100,7 +103,10 @@ function send(raw, callback) { const request = http.request(query, function(response) { var json = ''; response.on('data', (raw) => json = decryptJSON(raw)); - response.on('end', () => callback(json.result)); + response.on('end', () => { + if (json.error) throw new Error(json.error.message); + callback(json.result); + }); }); request.on('error', (error) => Error(error)); @@ -219,7 +225,7 @@ function isVerification(data) {
diff --git a/package.json b/package.json index c9b5b83..59cb272 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iii-client", - "version": "1.1.1", + "version": "1.1.2", "description": "Simple API for communicating with the bot of the \"iii.ru\" service.", "homepage": "https://github.com/valentineus/iii-client", "license": "MIT", diff --git a/src/index.js b/src/index.js index 24bfd6e..0d1f801 100644 --- a/src/index.js +++ b/src/index.js @@ -28,7 +28,10 @@ function connect(uuid, callback) { const request = http.request(query, function(response) { var json = ''; response.on('data', (raw) => json = decryptJSON(raw)); - response.on('end', () => callback(json.result)); + response.on('end', () => { + if (json.error) throw new Error(json.error.message); + callback(json.result); + }); }); request.on('error', (error) => Error(error.message)); @@ -59,7 +62,10 @@ function send(raw, callback) { const request = http.request(query, function(response) { var json = ''; response.on('data', (raw) => json = decryptJSON(raw)); - response.on('end', () => callback(json.result)); + response.on('end', () => { + if (json.error) throw new Error(json.error.message); + callback(json.result); + }); }); request.on('error', (error) => Error(error)); -- cgit v1.2.3