TypeError: Object #<Object> has no method 'emit'

The plugin was trying to emit an error from the wrong `this`, causing it to crash instead of displaying the error. This should fix that.