Permalink
Browse files

silently ignore error events

  • Loading branch information...
1 parent c7e2b97 commit 2a8bc3113a682e8df73d1fa509d40ef6d36577cb @amitkr committed Apr 9, 2012
Showing with 20 additions and 0 deletions.
  1. +20 −0 nodejs-db-informix.js
View
@@ -30,6 +30,26 @@ function extend(t, s) {
* @private {BaseEventEmitter} bee base event emitter
*/
var bee = extend(function() {}, ee);
+bee.prototype.emit = function() {
+ var type = arguments[0];
+ if (type === 'error'
+ && (!this._events
+ || !this._events.error
+ || (Array.isArray(this._events.error)
+ && !this._events.error.length)
+ )
+ )
+ {
+ // Silently allow unattached error events
+ return;
+ }
+
+ return ee.prototype.emit.apply(this, arguments);
+}
+
+/**
+ * export Query and Informix objects
+ */
exports.Query = extend(ib.Query, bee);
exports.Informix = extend(ib.Informix, bee);

0 comments on commit 2a8bc31

Please sign in to comment.