Skip to content

Commit

Permalink
Remove the error listener when done
Browse files Browse the repository at this point in the history
  • Loading branch information
enricostara committed Aug 13, 2015
1 parent 89a3f01 commit 4deab54
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ function callService(service, emitter, channel, callback) {
return new Promise(function (fulfill, reject) {
emitter.once('error', reject);
emitter.once(eventName, function (result) {
if ('mtproto.type.Rpc_error' == result.typeName) {
emitter.removeListener('error', reject);
if (result.instanceOf('mtproto.type.Rpc_error')) {
reject(new Error(result.error_message));
} else {
fulfill(result);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "telegram.link",
"version": "0.6.0",
"version": "0.6.1",
"description": "Telegram API library",
"keywords": [
"telegram",
Expand Down

0 comments on commit 4deab54

Please sign in to comment.