Comments (7)
I too am experiencing this error while using irc-message through twitch-irc.
The full trace of the error is:
[18:42:21] error - TypeError: Cannot read property 'tags' of null
at DestroyableTransform._transform (/Users/hoon/Workspace/ppr/node_modules/twitch-irc/node_modules/irc-message/index.js:148:35)
at DestroyableTransform.Transform._read (/Users/hoon/Workspace/ppr/node_modules/twitch-irc/node_modules/irc-message/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
at DestroyableTransform.Transform._write (/Users/hoon/Workspace/ppr/node_modules/twitch-irc/node_modules/irc-message/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12)
at doWrite (/Users/hoon/Workspace/ppr/node_modules/twitch-irc/node_modules/irc-message/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:237:10)
at writeOrBuffer (/Users/hoon/Workspace/ppr/node_modules/twitch-irc/node_modules/irc-message/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:227:5)
at DestroyableTransform.Writable.write (/Users/hoon/Workspace/ppr/node_modules/twitch-irc/node_modules/irc-message/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:194:11)
at Socket.ondata (_stream_readable.js:540:20)
at Socket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
at TCP.onread (net.js:538:20)
from irc-message.
Same, happens during a client reload or close.
from irc-message.
Here's a temporary hack I made on ./index.js
:
var stream = through.obj(function(chunk, encoding, done) {
buffer += chunk.toString()
messages = buffer.split(/\r\n/)
buffer = messages.pop()
// TEMP FIX FOR CRASHING
// by Jacob on August 6th, 2015
for (var i = 0; i < messages.length; i++) {
var message = messages[i]
var parsed = parse(message)
// support for IRCv3.2 server-time spec
var timestamp = parsed ? parsed.tags.time : null;
if (parsed && convertTimestamps) {
var converted = iso8601.toDate(timestamp)
parsed.tags.time = (converted) ? converted : new Date(NaN)
}
if (parsed && shouldParsePrefix) {
parsed.prefix = parsePrefix(parsed.prefix)
}
if (parsed === null) {
// Ignore Message If Parsed is Invalid
// Don't Emit Error, due to Crash
// this.emit('error', new Error('Invalid IRC message'))
} else {
this.push(parsed)
}
}
done()
})
from irc-message.
Could you please send in a pull request and add tests? Thank you!
On Fri, Aug 7, 2015 at 12:15 AM Jacob Payne [email protected]
wrote:
Here's a temporary hack I made on ./index.js:
var stream = through.obj(function(chunk, encoding, done) {
buffer += chunk.toString() messages = buffer.split(/\r\n/) buffer = messages.pop() // TEMP FIX FOR CRASHING // by Jacob on August 6th, 2015 for (var i = 0; i < messages.length; i++) { var message = messages[i] var parsed = parse(message) // support for IRCv3.2 server-time spec var timestamp = parsed ? parsed.tags.time : null; if (parsed && convertTimestamps) { var converted = iso8601.toDate(timestamp) parsed.tags.time = (converted) ? converted : new Date(NaN) } if (parsed && shouldParsePrefix) { parsed.prefix = parsePrefix(parsed.prefix) } if (parsed === null) { // Ignore Message If Parsed is Invalid // Don't Emit Error, due to Crash // this.emit('error', new Error('Invalid IRC message')) } else { this.push(parsed) } } done() })
—
Reply to this email directly or view it on GitHub
#18 (comment).
from irc-message.
Is the code an appropriate permanent fix though? He did mention it was a
temporary hack.
On Aug 7, 2015 11:46 AM, "Fionn Kelleher" [email protected] wrote:
Could you please send in a pull request and add tests? Thank you!
On Fri, Aug 7, 2015 at 12:15 AM Jacob Payne [email protected]
wrote:Here's a temporary hack I made on ./index.js:
var stream = through.obj(function(chunk, encoding, done) {
buffer += chunk.toString()
messages = buffer.split(/\r\n/)
buffer = messages.pop()// TEMP FIX FOR CRASHING
// by Jacob on August 6th, 2015for (var i = 0; i < messages.length; i++) {
var message = messages[i]
var parsed = parse(message)// support for IRCv3.2 server-time spec
var timestamp = parsed ? parsed.tags.time : null;if (parsed && convertTimestamps) {
var converted = iso8601.toDate(timestamp)
parsed.tags.time = (converted) ? converted : new Date(NaN)
}
if (parsed && shouldParsePrefix) {
parsed.prefix = parsePrefix(parsed.prefix)
}
if (parsed === null) {
// Ignore Message If Parsed is Invalid
// Don't Emit Error, due to Crash// this.emit('error', new Error('Invalid IRC message'))
} else {
this.push(parsed)
}}
done()
})—
Reply to this email directly or view it on GitHub
<#18 (comment)
.—
Reply to this email directly or view it on GitHub
#18 (comment).
from irc-message.
Seems to be an error with logging into npm at the moment, I'll try publish it later.
from irc-message.
% npm publish
+ [email protected]
from irc-message.
Related Issues (15)
- 0.3
- Combine prefixIsUserHostmask and parseHostmask into a single method. HOT 1
- Remove 'name' suffix from hostmask object keys. HOT 1
- Change 'command' to 'name' or 'type' HOT 1
- Fix parsing of commands with no params HOT 1
- Don't always Throw errors. HOT 4
- Error handling needs drastic improvement
- What to use it with? HOT 1
- Clean up #toString() from compiled CoffeeScript
- Prefixes aren't parsed correctly HOT 2
- 3.0.0 checklist
- Join/Part HOT 2
- IRC message write? HOT 2
- Revise tag parsing based on final spec
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from irc-message.