Comparing version 0.1.0 to 0.2.0
@@ -124,1 +124,17 @@ // BeepBoop is the language spoken by Eva. | ||
} | ||
/** | ||
* Given an object describing a message, throws if the message is invalid. | ||
* @param {Object} m | ||
*/ | ||
function validateMessage(m) { | ||
if (m.UID === 0xffffffff) { | ||
if (m.eventName !== '' || m.data !== null) { | ||
throw new SyntaxError('Malformed message received. DoneMessage must have:\n eventName === ""\n data === null') | ||
} | ||
} else if (m.UID === 0) { | ||
if (m.flags.isReponse) { | ||
throw new SyntaxError('Malformed message received. OneWayMessage must have:n\n flags.isReponse === false') | ||
} | ||
} | ||
} |
@@ -46,3 +46,3 @@ 'use strict' | ||
if (ev.code === 4200) {self.kill()} // User-initiated unclean kill. | ||
else if (ev.code === 4202) {fatalError(self, new Error('Remotely requested operation timed out.'), 4202)} | ||
else if (ev.code === 4202) {fatalError(self, new Error('Peer-requested operation timed out.'), 4202)} | ||
else if (ev.code === 4203) {self.kill()} // Remote graceful death timeout. | ||
@@ -110,3 +110,3 @@ else {fatalError(self, new Error(self._state === STATES.CONNECTING ? 'A connection could not be made.' : 'A problem occurred and the connection was closed.'))} | ||
this.on('error', function () {}) | ||
this._internal.emit('error') | ||
this._internal.emit('error', this._fatalError) | ||
} | ||
@@ -113,0 +113,0 @@ if (!wasDone) { |
{ | ||
"name": "eva-events", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Eva is like an EventEmitter, but over WebSockets.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32302
623