From 7787517a7a1a36c29bfb8c32c87a2aa01b55ed2e Mon Sep 17 00:00:00 2001 From: German Toro del Valle Date: Thu, 15 Sep 2016 14:35:36 +0200 Subject: [PATCH] Do not emit error event if no error when getting the token --- CHANGES_NEXT_RELEASE | 1 + lib/fiwareDeviceSimulator.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index e69de29..42b05b0 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -0,0 +1 @@ +- [BUG] Do not emit an error event if no error when getting the authentication token diff --git a/lib/fiwareDeviceSimulator.js b/lib/fiwareDeviceSimulator.js index c85ae71..50110b3 100644 --- a/lib/fiwareDeviceSimulator.js +++ b/lib/fiwareDeviceSimulator.js @@ -901,7 +901,9 @@ function requestToken(callback) { (body && body.error && body.error.code) + ', title: ' + (body && body.error && body.error.title) + ', message: ' + (body && body.error && body.error.message) + ')'); } - emitError(error); + if (error) { + emitError(error); + } return process.nextTick(callback.bind(null, error, response, body)); }); emitTokenRequest(tokenRequestOptions);