From 59afc3f34c3c3a583cc699d0bdf34d3f53d12ae3 Mon Sep 17 00:00:00 2001 From: starjumper30 Date: Wed, 27 Dec 2017 12:30:16 -0600 Subject: [PATCH] Added check for undefined keyword in getKeywordDocumentation method. Robot sends some meta-keywords such as __init__ and __intro__ that the client may not have defined. Return '' if the client did not supply definitions for these meta-keywords. (Before this change, server was terminating when trying to execute libdoc command against it: python -m robot.libdoc --name MyLibrary Remote::http://localhost:8270 MyLibrary.xml) --- lib/robotremote.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/robotremote.js b/lib/robotremote.js index 7773970..3d26c04 100644 --- a/lib/robotremote.js +++ b/lib/robotremote.js @@ -67,7 +67,14 @@ function Server(libraries, options, listeningCallback) { module.exports.Server = Server; Server.prototype.getKeywordDocumentation = function (name, response) { - response(null, this.keywords[name].doc); + /* + Checking for existence of keyword because Robot will send some + meta keywords, such as __init__ and __intro__, for the purposes + of generating documentation. Return '' if the client has not supplied + definitions for these meta keywords. + */ + var keyword = this.keywords[name]; + response(null, !!keyword ? keyword.doc : ''); }; Server.prototype.getKeywordTags = function (name, response) {