offline-issues
offline-issues copied to clipboard
Error running in parallel
Hello,
Executing the following command ends in an error:
$ offline-issues --state all USER/REPO
{ Error: read ECONNRESET
at _errnoException (util.js:1024:11)
at TLSWrap.onread (net.js:618:25) code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' } 'Error running in parallel.'
Error running in parallel.
/usr/local/lib/node_modules/offline-issues/src/index.js:121
issue.comments.forEach(function (comment) {
^
TypeError: issue.comments.forEach is not a function
at Request._callback (/usr/local/lib/node_modules/offline-issues/src/index.js:121:22)
at Request.self.callback (/usr/local/lib/node_modules/offline-issues/node_modules/request/request.js:186:22)
at emitTwo (events.js:125:13)
at Request.emit (events.js:213:7)
at Request.<anonymous> (/usr/local/lib/node_modules/offline-issues/node_modules/request/request.js:1163:10)
at emitOne (events.js:115:13)
at Request.emit (events.js:210:7)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/offline-issues/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:312:30)
at emitNone (events.js:110:20)
Any idea on how to get around this?
Thanks!
I worked around the problem by editing index.js:121 and changing it as follows:
if(issue.comments.forEach instanceof Function) issue.comments.forEach(function (comment) {
I was also required to make a similar fix to writehtml.js:60
That definitely helps, although I still get the issue on some repos, such as Wilfred/helpful. It works on the other repos I've tried though. Here's a diff:
diff --git i/src/index.js w/src/index.js
index 88d11fb..6d036e0 100644
--- i/src/index.js
+++ w/src/index.js
@@ -118,7 +118,7 @@ module.exports = function (token, options, cb) {
if (err) return cb(err, 'Error in request for comments.')
issue.comments = body
- issue.comments.forEach(function (comment) {
+ if(issue.comments.forEach instanceof Function) issue.comments.forEach(function (comment) {
comment.created_at = new Date(comment.created_at).toLocaleDateString()
})
issueData.push(issue)
diff --git i/src/writehtml.js w/src/writehtml.js
index 721a1ff..085649c 100644
--- i/src/writehtml.js
+++ w/src/writehtml.js
@@ -63,9 +63,12 @@ function repoDetails (issue) {
function parseBody (issue) {
if (issue.body === null) issue.body = ''
else issue.body = marked(issue.body)
- issue.comments = issue.comments.map(function (issue) {
- issue.body = marked(issue.body)
- return issue
- })
+
+ if(issue.comments.map instanceof Function) {
+ issue.comments = issue.comments.map(function (issue) {
+ issue.body = marked(issue.body)
+ return issue
+ })
+ }
return issue
}