mirror of
https://github.com/valentineus/iii-client.git
synced 2025-07-01 10:30:27 +03:00
Release of version 1.1.2.
This commit is contained in:
10
src/index.js
10
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));
|
||||
|
Reference in New Issue
Block a user