diff options
-rw-r--r-- | CHANGELOG.md | 7 | ||||
-rw-r--r-- | docs/global.html | 16 | ||||
-rw-r--r-- | docs/index.html | 2 | ||||
-rw-r--r-- | docs/index.js.html | 12 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | 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 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="index.js.html">index.js</a>, <a href="index.js.html#line139">line 139</a> + <a href="index.js.html">index.js</a>, <a href="index.js.html#line145">line 145</a> </li></ul></dd> @@ -632,7 +632,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="index.js.html">index.js</a>, <a href="index.js.html#line91">line 91</a> + <a href="index.js.html">index.js</a>, <a href="index.js.html#line97">line 97</a> </li></ul></dd> @@ -792,7 +792,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="index.js.html">index.js</a>, <a href="index.js.html#line105">line 105</a> + <a href="index.js.html">index.js</a>, <a href="index.js.html#line111">line 111</a> </li></ul></dd> @@ -952,7 +952,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="index.js.html">index.js</a>, <a href="index.js.html#line77">line 77</a> + <a href="index.js.html">index.js</a>, <a href="index.js.html#line83">line 83</a> </li></ul></dd> @@ -1112,7 +1112,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="index.js.html">index.js</a>, <a href="index.js.html#line164">line 164</a> + <a href="index.js.html">index.js</a>, <a href="index.js.html#line170">line 170</a> </li></ul></dd> @@ -1268,7 +1268,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="index.js.html">index.js</a>, <a href="index.js.html#line119">line 119</a> + <a href="index.js.html">index.js</a>, <a href="index.js.html#line125">line 125</a> </li></ul></dd> @@ -1428,7 +1428,7 @@ <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> - <a href="index.js.html">index.js</a>, <a href="index.js.html#line47">line 47</a> + <a href="index.js.html">index.js</a>, <a href="index.js.html#line50">line 50</a> </li></ul></dd> @@ -1635,7 +1635,7 @@ <br class="clear"> <footer> - Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jun 05 2017 16:37:40 GMT+0000 (UTC) using the Minami theme. + Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat Jun 10 2017 20:41:57 GMT+0000 (UTC) using the Minami theme. </footer> <script>prettyPrint();</script> 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 @@ <br class="clear"> <footer> - Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jun 05 2017 16:37:40 GMT+0000 (UTC) using the Minami theme. + Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat Jun 10 2017 20:41:57 GMT+0000 (UTC) using the Minami theme. </footer> <script>prettyPrint();</script> 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) { <br class="clear"> <footer> - Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jun 05 2017 16:37:40 GMT+0000 (UTC) using the Minami theme. + Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat Jun 10 2017 20:41:57 GMT+0000 (UTC) using the Minami theme. </footer> <script>prettyPrint();</script> 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)); |